Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
2123d5e7
Commit
2123d5e7
authored
Nov 01, 2013
by
Greg Price
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1570 from edx/gprice/forum-staff-label
Remove label from forum posts by global staff
parents
25ec2179
c4cdb457
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
9 deletions
+13
-9
CHANGELOG.rst
+3
-0
common/static/coffee/src/discussion/utils.coffee
+1
-1
lms/djangoapps/django_comment_client/tests/test_utils.py
+6
-1
lms/djangoapps/django_comment_client/utils.py
+3
-7
No files found.
CHANGELOG.rst
View file @
2123d5e7
...
@@ -5,6 +5,9 @@ These are notable changes in edx-platform. This is a rolling list of changes,
...
@@ -5,6 +5,9 @@ These are notable changes in edx-platform. This is a rolling list of changes,
in roughly chronological order, most recent first. Add your entries at or near
in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected.
the top. Include a label indicating the component affected.
LMS: Users with is_staff=True no longer have the STAFF label appear on
their forum posts.
Blades: Video start and end times now function the same for both YouTube and
Blades: Video start and end times now function the same for both YouTube and
HTML5 videos. If end time is set, the video can still play until the end, after
HTML5 videos. If end time is set, the video can still play until the end, after
it pauses on the end time.
it pauses on the end time.
...
...
common/static/coffee/src/discussion/utils.coffee
View file @
2123d5e7
...
@@ -26,7 +26,7 @@ class @DiscussionUtil
...
@@ -26,7 +26,7 @@ class @DiscussionUtil
@
loadFlagModerator
(
$
(
"#discussion-container"
).
data
(
"flag-moderator"
))
@
loadFlagModerator
(
$
(
"#discussion-container"
).
data
(
"flag-moderator"
))
@
isStaff
:
(
user_id
)
->
@
isStaff
:
(
user_id
)
->
staff
=
_
.
union
(
@
roleIds
[
'
Staff'
],
@
roleIds
[
'
Moderator'
],
@
roleIds
[
'Administrator'
])
staff
=
_
.
union
(
@
roleIds
[
'Moderator'
],
@
roleIds
[
'Administrator'
])
_
.
include
(
staff
,
parseInt
(
user_id
))
_
.
include
(
staff
,
parseInt
(
user_id
))
@
isTA
:
(
user_id
)
->
@
isTA
:
(
user_id
)
->
...
...
lms/djangoapps/django_comment_client/tests/test_utils.py
View file @
2123d5e7
...
@@ -39,6 +39,7 @@ class AccessUtilsTestCase(TestCase):
...
@@ -39,6 +39,7 @@ class AccessUtilsTestCase(TestCase):
self
.
course_id
=
'edX/toy/2012_Fall'
self
.
course_id
=
'edX/toy/2012_Fall'
self
.
student_role
=
RoleFactory
(
name
=
'Student'
,
course_id
=
self
.
course_id
)
self
.
student_role
=
RoleFactory
(
name
=
'Student'
,
course_id
=
self
.
course_id
)
self
.
moderator_role
=
RoleFactory
(
name
=
'Moderator'
,
course_id
=
self
.
course_id
)
self
.
moderator_role
=
RoleFactory
(
name
=
'Moderator'
,
course_id
=
self
.
course_id
)
self
.
community_ta_role
=
RoleFactory
(
name
=
'Community TA'
,
course_id
=
self
.
course_id
)
self
.
student1
=
UserFactory
(
username
=
'student'
,
email
=
'student@edx.org'
)
self
.
student1
=
UserFactory
(
username
=
'student'
,
email
=
'student@edx.org'
)
self
.
student1_enrollment
=
CourseEnrollmentFactory
(
user
=
self
.
student1
)
self
.
student1_enrollment
=
CourseEnrollmentFactory
(
user
=
self
.
student1
)
self
.
student_role
.
users
.
add
(
self
.
student1
)
self
.
student_role
.
users
.
add
(
self
.
student1
)
...
@@ -47,10 +48,14 @@ class AccessUtilsTestCase(TestCase):
...
@@ -47,10 +48,14 @@ class AccessUtilsTestCase(TestCase):
self
.
moderator
=
UserFactory
(
username
=
'moderator'
,
email
=
'staff@edx.org'
,
is_staff
=
True
)
self
.
moderator
=
UserFactory
(
username
=
'moderator'
,
email
=
'staff@edx.org'
,
is_staff
=
True
)
self
.
moderator_enrollment
=
CourseEnrollmentFactory
(
user
=
self
.
moderator
)
self
.
moderator_enrollment
=
CourseEnrollmentFactory
(
user
=
self
.
moderator
)
self
.
moderator_role
.
users
.
add
(
self
.
moderator
)
self
.
moderator_role
.
users
.
add
(
self
.
moderator
)
self
.
community_ta1
=
UserFactory
(
username
=
'community_ta1'
,
email
=
'community_ta1@edx.org'
)
self
.
community_ta_role
.
users
.
add
(
self
.
community_ta1
)
self
.
community_ta2
=
UserFactory
(
username
=
'community_ta2'
,
email
=
'community_ta2@edx.org'
)
self
.
community_ta_role
.
users
.
add
(
self
.
community_ta2
)
def
test_get_role_ids
(
self
):
def
test_get_role_ids
(
self
):
ret
=
utils
.
get_role_ids
(
self
.
course_id
)
ret
=
utils
.
get_role_ids
(
self
.
course_id
)
expected
=
{
u'Moderator'
:
[
3
],
u'
Student'
:
[
1
,
2
],
'Staff'
:
[
3
]}
expected
=
{
u'Moderator'
:
[
3
],
u'
Community TA'
:
[
4
,
5
]}
self
.
assertEqual
(
ret
,
expected
)
self
.
assertEqual
(
ret
,
expected
)
def
test_has_forum_access
(
self
):
def
test_has_forum_access
(
self
):
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
2123d5e7
...
@@ -9,7 +9,7 @@ from django.core.urlresolvers import reverse
...
@@ -9,7 +9,7 @@ from django.core.urlresolvers import reverse
from
django.db
import
connection
from
django.db
import
connection
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.utils
import
simplejson
from
django.utils
import
simplejson
from
django_comment_common.models
import
Role
from
django_comment_common.models
import
Role
,
FORUM_ROLE_STUDENT
from
django_comment_client.permissions
import
check_permissions_by_view
from
django_comment_client.permissions
import
check_permissions_by_view
import
mitxmako
import
mitxmako
...
@@ -42,12 +42,8 @@ def merge_dict(dic1, dic2):
...
@@ -42,12 +42,8 @@ def merge_dict(dic1, dic2):
def
get_role_ids
(
course_id
):
def
get_role_ids
(
course_id
):
roles
=
Role
.
objects
.
filter
(
course_id
=
course_id
)
roles
=
Role
.
objects
.
filter
(
course_id
=
course_id
)
.
exclude
(
name
=
FORUM_ROLE_STUDENT
)
staff
=
list
(
User
.
objects
.
filter
(
is_staff
=
True
)
.
values_list
(
'id'
,
flat
=
True
))
return
dict
([(
role
.
name
,
list
(
role
.
users
.
values_list
(
'id'
,
flat
=
True
)))
for
role
in
roles
])
roles_with_ids
=
{
'Staff'
:
staff
}
for
role
in
roles
:
roles_with_ids
[
role
.
name
]
=
list
(
role
.
users
.
values_list
(
'id'
,
flat
=
True
))
return
roles_with_ids
def
has_forum_access
(
uname
,
course_id
,
rolename
):
def
has_forum_access
(
uname
,
course_id
,
rolename
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment