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
f5840489
Commit
f5840489
authored
Aug 04, 2015
by
Daniel Friedman
Committed by
Andy Armstrong
Aug 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow editing of own post in team discussion
parent
dd67f8aa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
6 deletions
+14
-6
lms/djangoapps/django_comment_client/base/tests.py
+6
-2
lms/djangoapps/django_comment_client/base/views.py
+5
-3
lms/djangoapps/django_comment_client/forum/views.py
+2
-1
lms/djangoapps/django_comment_client/utils.py
+1
-0
No files found.
lms/djangoapps/django_comment_client/base/tests.py
View file @
f5840489
...
...
@@ -1193,7 +1193,11 @@ class TeamsPermissionsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSe
thread_author
=
getattr
(
self
,
thread_author
)
self
.
_setup_mock
(
user
,
mock_request
,
# user is the person making the request.
{
"user_id"
:
str
(
thread_author
.
id
),
"closed"
:
False
,
"commentable_id"
:
commentable_id
}
{
"user_id"
:
str
(
thread_author
.
id
),
"closed"
:
False
,
"commentable_id"
:
commentable_id
,
"context"
:
"standalone"
}
)
response
=
self
.
client
.
post
(
reverse
(
...
...
@@ -1203,7 +1207,7 @@ class TeamsPermissionsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSe
"thread_id"
:
"dummy"
}
),
data
=
{
"body"
:
"foo"
,
"title"
:
"foo"
}
data
=
{
"body"
:
"foo"
,
"title"
:
"foo"
,
"commentable_id"
:
commentable_id
}
)
self
.
assertEqual
(
response
.
status_code
,
status_code
)
...
...
lms/djangoapps/django_comment_client/base/views.py
View file @
f5840489
...
...
@@ -250,11 +250,13 @@ def update_thread(request, course_id, thread_id):
if
"thread_type"
in
request
.
POST
:
thread
.
thread_type
=
request
.
POST
[
"thread_type"
]
if
"commentable_id"
in
request
.
POST
:
commentable_id
=
request
.
POST
[
"commentable_id"
]
course
=
get_course_with_access
(
request
.
user
,
'load'
,
course_key
)
if
discussion_category_id_access
(
course
,
request
.
user
,
request
.
POST
.
get
(
"commentable_id"
)):
thread
.
commentable_id
=
request
.
POST
[
"commentable_id"
]
else
:
thread_context
=
getattr
(
thread
,
"context"
,
"course"
)
if
thread_context
==
"course"
and
not
discussion_category_id_access
(
course
,
request
.
user
,
commentable_id
):
return
JsonError
(
_
(
"Topic doesn't exist"
))
else
:
thread
.
commentable_id
=
commentable_id
thread
.
save
()
if
request
.
is_ajax
():
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
f5840489
...
...
@@ -336,7 +336,8 @@ def single_thread(request, course_key, discussion_id, thread_id):
raise
# Verify that the student has access to this thread if belongs to a course discussion module
if
thread
.
context
==
"course"
and
not
utils
.
discussion_category_id_access
(
course
,
request
.
user
,
discussion_id
):
thread_context
=
getattr
(
thread
,
"context"
,
"course"
)
if
thread_context
==
"course"
and
not
utils
.
discussion_category_id_access
(
course
,
request
.
user
,
discussion_id
):
raise
Http404
# verify that the thread belongs to the requesting student's cohort
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
f5840489
...
...
@@ -351,6 +351,7 @@ def get_discussion_category_map(course, user, cohorted_if_in_list=False, exclude
def
discussion_category_id_access
(
course
,
user
,
discussion_id
):
"""
Returns True iff the given discussion_id is accessible for user in course.
Assumes that the commentable identified by discussion_id has a null or 'course' context.
Uses the discussion id cache if available, falling back to
get_discussion_categories_ids if there is no cache.
"""
...
...
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