Merge pull request #4383 from mlkwaqas/waqas/for156-anonymous-posts-labels-user-roles
Fix anonymous posts appear are labeled with the logged in user's role
This commit is contained in:
@@ -2,6 +2,22 @@ describe 'All Content', ->
|
||||
beforeEach ->
|
||||
DiscussionSpecHelper.setUpGlobals()
|
||||
|
||||
describe 'Staff and TA Content', ->
|
||||
beforeEach ->
|
||||
DiscussionUtil.loadRoles({"Moderator": [567], "Administrator": [567], "Community TA": [567]})
|
||||
|
||||
it 'anonymous thread should not include login role label', ->
|
||||
anon_content = new Content
|
||||
anon_content.initialize
|
||||
expect(anon_content.get 'staff_authored').toBe false
|
||||
expect(anon_content.get 'community_ta_authored').toBe false
|
||||
|
||||
it 'general thread should include login role label', ->
|
||||
anon_content = new Content { user_id: '567' }
|
||||
anon_content.initialize
|
||||
expect(anon_content.get 'staff_authored').toBe true
|
||||
expect(anon_content.get 'community_ta_authored').toBe true
|
||||
|
||||
describe 'Content', ->
|
||||
beforeEach ->
|
||||
@content = new Content {
|
||||
|
||||
@@ -54,8 +54,12 @@ if Backbone?
|
||||
initialize: ->
|
||||
Content.addContent @id, @
|
||||
userId = @get('user_id')
|
||||
@set('staff_authored', DiscussionUtil.isStaff(userId))
|
||||
@set('community_ta_authored', DiscussionUtil.isTA(userId))
|
||||
if userId?
|
||||
@set('staff_authored', DiscussionUtil.isStaff(userId))
|
||||
@set('community_ta_authored', DiscussionUtil.isTA(userId))
|
||||
else
|
||||
@set('staff_authored', false)
|
||||
@set('community_ta_authored', false)
|
||||
if Content.getInfo(@id)
|
||||
@updateInfo(Content.getInfo(@id))
|
||||
@set 'user_url', DiscussionUtil.urlFor('user_profile', userId)
|
||||
|
||||
Reference in New Issue
Block a user