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
7de58823
Commit
7de58823
authored
Nov 06, 2015
by
wajeeha-khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MA-860; No moderator permissions on closed thread
parent
9fcc1c32
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
3 deletions
+25
-3
lms/djangoapps/discussion_api/api.py
+4
-0
lms/djangoapps/discussion_api/permissions.py
+9
-1
lms/djangoapps/discussion_api/tests/test_api.py
+2
-2
lms/djangoapps/discussion_api/tests/test_views.py
+0
-0
lms/djangoapps/discussion_api/tests/utils.py
+10
-0
No files found.
lms/djangoapps/discussion_api/api.py
View file @
7de58823
...
...
@@ -601,6 +601,10 @@ def create_comment(request, comment_data):
except
Http404
:
raise
ValidationError
({
"thread_id"
:
[
"Invalid value."
]})
# if a thread is closed; no new comments could be made to it
if
cc_thread
[
'closed'
]:
raise
PermissionDenied
_check_initializable_comment_fields
(
comment_data
,
context
)
serializer
=
CommentSerializer
(
data
=
comment_data
,
context
=
context
)
actions_form
=
CommentActionsForm
(
comment_data
)
...
...
lms/djangoapps/discussion_api/permissions.py
View file @
7de58823
...
...
@@ -56,8 +56,16 @@ def get_editable_fields(cc_content, context):
"""
Return the set of fields that the requester can edit on the given content
"""
# no edits, except 'abuse_flagged' are allowed on closed threads
ret
=
{
"abuse_flagged"
}
if
(
cc_content
[
"type"
]
==
"thread"
and
cc_content
[
"closed"
])
or
(
cc_content
[
"type"
]
==
"comment"
and
context
[
"thread"
][
"closed"
]
):
return
ret
# Shared fields
ret
=
{
"abuse_flagged"
,
"voted"
}
ret
|=
{
"voted"
}
if
_is_author_or_privileged
(
cc_content
,
context
):
ret
|=
{
"raw_body"
}
...
...
lms/djangoapps/discussion_api/tests/test_api.py
View file @
7de58823
...
...
@@ -614,7 +614,7 @@ class GetThreadListTest(CommentsServiceMockMixin, UrlResetMixin, SharedModuleSto
"title"
:
"Another Test Title"
,
"body"
:
"More content"
,
"pinned"
:
False
,
"closed"
:
Tru
e
,
"closed"
:
Fals
e
,
"abuse_flaggers"
:
[],
"votes"
:
{
"up_count"
:
9
},
"comments_count"
:
18
,
...
...
@@ -668,7 +668,7 @@ class GetThreadListTest(CommentsServiceMockMixin, UrlResetMixin, SharedModuleSto
"raw_body"
:
"More content"
,
"rendered_body"
:
"<p>More content</p>"
,
"pinned"
:
False
,
"closed"
:
Tru
e
,
"closed"
:
Fals
e
,
"following"
:
False
,
"abuse_flagged"
:
False
,
"voted"
:
False
,
...
...
lms/djangoapps/discussion_api/tests/test_views.py
View file @
7de58823
This diff is collapsed.
Click to expand it.
lms/djangoapps/discussion_api/tests/utils.py
View file @
7de58823
...
...
@@ -301,6 +301,16 @@ class CommentsServiceMockMixin(object):
"""
self
.
assert_query_params_equal
(
httpretty
.
last_request
(),
expected_params
)
def
request_patch
(
self
,
request_data
):
"""
make a request to PATCH endpoint and return response
"""
return
self
.
client
.
patch
(
# pylint: disable=no-member
self
.
url
,
json
.
dumps
(
request_data
),
content_type
=
"application/merge-patch+json"
)
def
make_minimal_cs_thread
(
overrides
=
None
):
"""
...
...
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