Commit 7e8b1992 by Mike Chen

show endorsed checkmark based on permissions

parent af656fcf
......@@ -132,6 +132,7 @@ def get_annotated_content_info(content, user, is_thread):
return {
'editable': check_permissions_by_view(user, content, "update_thread" if is_thread else "update_comment"),
'can_reply': check_permissions_by_view(user, content, "create_comment" if is_thread else "create_sub_comment"),
'can_endorse': check_permissions_by_view(user, content, "endorse_comment") if not is_thread else False,
}
def get_annotated_content_infos(thread, user):
......
......@@ -324,3 +324,5 @@ initializeFollowThread = (thread) ->
$local(".discussion-edit").remove()
if not Discussion.getContentInfo id, 'can_reply'
$local(".discussion-reply").remove()
if not Discussion.getContentInfo id, 'can_endorse'
$local(".discussion-endorse-control").remove()
......@@ -78,14 +78,16 @@
${render_info(content)}
${render_link("discussion-link discussion-reply discussion-reply-" + type, "Reply")}
${render_link("discussion-link discussion-edit", "Edit")}
% if type == "comment" and request.user.is_staff:
% if content['endorsed']:
<input type="checkbox" checked="checked" class="discussion-link discussion-endorse" id="discussion-endorse-${content['id']}">
<span class="discussion-endorse-control">
% if content.get('endorsed', False):
<input type="checkbox" checked="checked" class="discussion-link discussion-endorse" id="discussion-endorse-${content['id']}" />
% else:
<input type="checkbox" class="discussion-link discussion-endorse" id="discussion-endorse-${content['id']}">
<input type="checkbox" class="discussion-link discussion-endorse" id="discussion-endorse-${content['id']}" />
% endif
<label class="discussion-link" for="discussion-endorse-${content['id']}">Endorsed</label>
% endif
</span>
% if type == "thread" and request.user.is_staff:
% if content['closed']:
<a class="discussion-openclose" id="discussion-openclose-${content['id']}" href="javascript:void(0);">Re-open thread</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment