fix Close Thread showing for students and empty bracket in search bar
This commit is contained in:
@@ -149,12 +149,14 @@ def forum_form_discussion(request, course_id, discussion_id):
|
||||
|
||||
|
||||
def get_annotated_content_info(course_id, content, user, is_thread):
|
||||
return {
|
||||
permissions = {
|
||||
'editable': check_permissions_by_view(user, course_id, content, "update_thread" if is_thread else "update_comment"),
|
||||
'can_reply': check_permissions_by_view(user, course_id, content, "create_comment" if is_thread else "create_sub_comment"),
|
||||
'can_endorse': check_permissions_by_view(user, course_id, content, "endorse_comment") if not is_thread else False,
|
||||
'can_delete': check_permissions_by_view(user, course_id, content, "delete_thread" if is_thread else "delete_comment"),
|
||||
'can_openclose': check_permissions_by_view(user, course_id, content, "openclose_thread") if is_thread else False,
|
||||
}
|
||||
return permissions
|
||||
|
||||
def get_annotated_content_infos(course_id, thread, user, is_thread=True):
|
||||
infos = {}
|
||||
|
||||
@@ -67,11 +67,10 @@ def check_conditions_permissions(user, permissions, course_id, **kwargs):
|
||||
|
||||
|
||||
VIEW_PERMISSIONS = {
|
||||
'update_thread' : ['edit_content', ['update_thread', 'is_open', 'author']],
|
||||
# 'create_comment' : [["create_comment", "is_open"]],
|
||||
'create_comment' : ["create_comment"],
|
||||
'update_thread' : ['edit_content', ['update_thread', 'is_open', 'is_author']],
|
||||
'create_comment' : [["create_comment", "is_open"]],
|
||||
'delete_thread' : ['delete_thread'],
|
||||
'update_comment' : ['edit_content', ['update_comment', 'is_open', 'author']],
|
||||
'update_comment' : ['edit_content', ['update_comment', 'is_open', 'is_author']],
|
||||
'endorse_comment' : ['endorse_comment'],
|
||||
'openclose_thread' : ['openclose_thread'],
|
||||
'create_sub_comment': [['create_sub_comment', 'is_open']],
|
||||
|
||||
@@ -372,3 +372,5 @@ initializeFollowThread = (thread) ->
|
||||
$local(".discussion-endorse-control").remove()
|
||||
if not Discussion.getContentInfo id, 'can_delete'
|
||||
$local(".discussion-delete").remove()
|
||||
if not Discussion.getContentInfo id, 'can_openclose'
|
||||
$local(".discussion-openclose").remove()
|
||||
|
||||
@@ -12,7 +12,7 @@ def base_url_for_search():
|
||||
% if query_params.get('tags', None):
|
||||
<input class="search-input" type="text" value="[${tags}]${text}" id="keywords" autocomplete="off"/>
|
||||
% else:
|
||||
<input class="search-input" type="text" value="[${tags}]${text}" id="keywords" autocomplete="off"/>
|
||||
<input class="search-input" type="text" value="${text}" id="keywords" autocomplete="off"/>
|
||||
% endif
|
||||
<div class="discussion-link discussion-search-link" href="javascript:void(0)">Search posts</div>
|
||||
</form>
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<label class="discussion-link" for="discussion-endorse-${content['id']}">Endorsed</label>
|
||||
</span>
|
||||
|
||||
% if type == "thread" and request.user.is_staff:
|
||||
% if type == "thread":
|
||||
% if content['closed']:
|
||||
<a class="discussion-openclose" id="discussion-openclose-${content['id']}" href="javascript:void(0);">Re-open thread</a>
|
||||
% else:
|
||||
|
||||
Reference in New Issue
Block a user