Fix staff markers for inline threads and double staff markers for threads with deeply nested comments.
This commit is contained in:
@@ -172,7 +172,8 @@ def inline_discussion(request, course_id, discussion_id):
|
||||
'user_info': user_info,
|
||||
'annotated_content_info': annotated_content_info,
|
||||
'page': query_params['page'],
|
||||
'num_pages': query_params['num_pages']
|
||||
'num_pages': query_params['num_pages'],
|
||||
'roles': utils.get_role_ids(course_id),
|
||||
})
|
||||
|
||||
@login_required
|
||||
|
||||
@@ -10,7 +10,7 @@ if Backbone?
|
||||
page_re: /\?discussion_page=(\d+)/
|
||||
initialize: ->
|
||||
@toggleDiscussionBtn = @$(".discussion-show")
|
||||
# Set the page if it was set in the URL. This is used to allow deep linking to pages
|
||||
# Set the page if it was set in the URL. This is used to allow deep linking to pages
|
||||
match = @page_re.exec(window.location.href)
|
||||
if match
|
||||
@page = parseInt(match[1])
|
||||
@@ -21,7 +21,7 @@ if Backbone?
|
||||
event.preventDefault()
|
||||
if !@newPostForm
|
||||
@toggleDiscussion()
|
||||
@isWaitingOnNewPost = true;
|
||||
@isWaitingOnNewPost = true;
|
||||
return
|
||||
if @showed
|
||||
@newPostForm.slideDown(300)
|
||||
@@ -67,6 +67,7 @@ if Backbone?
|
||||
renderDiscussion: ($elem, response, textStatus, discussionId) =>
|
||||
window.user = new DiscussionUser(response.user_info)
|
||||
Content.loadContentInfos(response.annotated_content_info)
|
||||
DiscussionUtil.loadRoles(response.roles)
|
||||
# $elem.html("Hide Discussion")
|
||||
@discussion = new Discussion()
|
||||
@discussion.reset(response.discussion_data, {silent: false})
|
||||
|
||||
@@ -2,6 +2,7 @@ if Backbone?
|
||||
DiscussionApp =
|
||||
start: (elem)->
|
||||
# TODO: Perhaps eliminate usage of global variables when possible
|
||||
DiscussionUtil.loadRolesFromContainer()
|
||||
element = $(elem)
|
||||
window.$$course_id = element.data("course-id")
|
||||
user_info = element.data("user-info")
|
||||
|
||||
@@ -15,9 +15,14 @@ class @DiscussionUtil
|
||||
@getTemplate: (id) ->
|
||||
$("script##{id}").html()
|
||||
|
||||
@loadRoles: (roles)->
|
||||
@roleIds = roles
|
||||
|
||||
@loadRolesFromContainer: ->
|
||||
@loadRoles($("#discussion-container").data("roles"))
|
||||
|
||||
@isStaff: (user_id) ->
|
||||
ids = $("#discussion-container").data("roles")
|
||||
staff = _.union(ids['Staff'], ids['Moderator'], ids['Administrator'])
|
||||
staff = _.union(@roleIds['Staff'], @roleIds['Moderator'], @roleIds['Administrator'])
|
||||
_.include(staff, parseInt(user_id))
|
||||
|
||||
@bulkUpdateContentInfo: (infos) ->
|
||||
|
||||
@@ -33,4 +33,4 @@ if Backbone?
|
||||
|
||||
markAsStaff: ->
|
||||
if DiscussionUtil.isStaff(@model.get("user_id"))
|
||||
@$el.find("a").after('<span class="staff-label">staff</span>')
|
||||
@$el.find("a.profile-link").after('<span class="staff-label">staff</span>')
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<a href="#comment_${'<%- parent_id %>'}">@${'<%- parent_username %>'}</a>:
|
||||
${'<% }%>'}
|
||||
<span class="response-body">${'<%- body %>'}</span>
|
||||
<span class="posted-details">–posted <span class="timeago" title="${'<%- created_at %>'}">${'<%- created_at %>'}</span> by <a href="${'<%- user_url %>'}">${'<%- username %>'}</a></span>
|
||||
<span class="posted-details">–posted <span class="timeago" title="${'<%- created_at %>'}">${'<%- created_at %>'}</span> by <a href="${'<%- user_url %>'}" class="profile-link">${'<%- username %>'}</a></span>
|
||||
</p>
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user