diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-05-06 20:54:07 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-05-06 20:54:07 -0400 |
commit | a26bca9638a5fe77f5e833738386e6805a177744 (patch) | |
tree | 442ef27cfe9c4deadc29295e069e2bcac3c7e6de | |
parent | cf3605b7c0a86e799077f440e97645b22a69b8a0 (diff) | |
download | askbot-a26bca9638a5fe77f5e833738386e6805a177744.tar.gz askbot-a26bca9638a5fe77f5e833738386e6805a177744.tar.bz2 askbot-a26bca9638a5fe77f5e833738386e6805a177744.zip |
restricted comment edits only to post owners and mods/admins
-rw-r--r-- | askbot/media/js/post.js | 8 | ||||
-rw-r--r-- | askbot/templates/question.html | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/askbot/media/js/post.js b/askbot/media/js/post.js index 4a2fb0d6..7f9e3d42 100644 --- a/askbot/media/js/post.js +++ b/askbot/media/js/post.js @@ -2225,8 +2225,12 @@ Comment.prototype.loadText = function(on_load_handler){ url: askbot['urls']['getComment'], data: {id: this._data['id']}, success: function(json){ - me._data['text'] = json['text']; - on_load_handler() + if (json['success']) { + me._data['text'] = json['text']; + on_load_handler() + } else { + showMessage(me.getElement(), json['message'], 'after'); + } }, error: function(xhr, textStatus, exception) { showMessage(me.getElement(), xhr.responseText, 'after'); diff --git a/askbot/templates/question.html b/askbot/templates/question.html index 3364cc2f..9a508a2f 100644 --- a/askbot/templates/question.html +++ b/askbot/templates/question.html @@ -62,6 +62,13 @@ return null; }; + var postIsComment = function(postId) { + if (document.getElementById('comment-' + postId)) { + return true; + } + return false; + }; + var removeNode = function(node) { node.parentNode.removeChild(node); }; @@ -186,9 +193,9 @@ ) { removeNode(closeBtn[0]); } + var repLow = (data['userReputation'] < {{settings.MIN_REP_TO_EDIT_OTHERS_POSTS}}); if (//maybe remove "edit" button - data['userReputation'] < - {{settings.MIN_REP_TO_EDIT_OTHERS_POSTS}} + repLow || postIsComment(post_id)//only authors edit comments ){ var edit_btn = document.getElementById( 'post-' + post_id + '-edit' |