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
93978da8
Commit
93978da8
authored
Apr 09, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes cleanup
parent
8358e516
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
4 deletions
+19
-4
common/static/coffee/src/discussion/content.coffee
+7
-1
lms/djangoapps/django_comment_client/base/views.py
+9
-0
lms/djangoapps/django_comment_client/permissions.py
+2
-2
lms/lib/comment_client/thread.py
+1
-1
No files found.
common/static/coffee/src/discussion/content.coffee
View file @
93978da8
...
...
@@ -144,7 +144,13 @@ if Backbone?
else
@
get
(
"body"
)
display_tigetCommentsCount
:
->
display_title
:
->
if
@
has
(
"highlighted_title"
)
String
(
@
get
(
"highlighted_title"
)).
replace
(
/<highlight>/g
,
'<mark>'
).
replace
(
/<\/highlight>/g
,
'</mark>'
)
else
@
get
(
"title"
)
comment_count
:
->
count
=
0
@
get
(
'comments'
).
each
(
comment
)
->
count
+=
comment
.
getCommentsCount
()
+
1
...
...
lms/djangoapps/django_comment_client/base/views.py
View file @
93978da8
...
...
@@ -293,6 +293,9 @@ def flag_abuse_for_thread(request, course_id, thread_id):
thread
.
flagAbuse
(
user
,
thread
)
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()))
@require_POST
@login_required
@permitted
def
un_flag_abuse_for_thread
(
request
,
course_id
,
thread_id
):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
...
...
@@ -301,12 +304,18 @@ def un_flag_abuse_for_thread(request, course_id, thread_id):
thread
.
unFlagAbuse
(
user
,
thread
,
removeAll
)
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()))
@require_POST
@login_required
@permitted
def
flag_abuse_for_comment
(
request
,
course_id
,
comment_id
):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
comment
=
cc
.
Comment
.
find
(
comment_id
)
comment
.
flagAbuse
(
user
,
comment
)
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()))
@require_POST
@login_required
@permitted
def
un_flag_abuse_for_comment
(
request
,
course_id
,
comment_id
):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
removeAll
=
cached_has_permission
(
request
.
user
,
'openclose_thread'
,
course_id
)
...
...
lms/djangoapps/django_comment_client/permissions.py
View file @
93978da8
...
...
@@ -73,8 +73,7 @@ def check_conditions_permissions(user, permissions, course_id, **kwargs):
return
True
in
results
elif
operator
==
"and"
:
return
not
False
in
results
return
True
#return test(user, permissions, operator="or")
return
test
(
user
,
permissions
,
operator
=
"or"
)
VIEW_PERMISSIONS
=
{
...
...
@@ -90,6 +89,7 @@ VIEW_PERMISSIONS = {
'undo_vote_for_comment'
:
[[
'unvote'
,
'is_open'
]],
'vote_for_thread'
:
[[
'vote'
,
'is_open'
]],
'flag_abuse_for_thread'
:
[[
'vote'
,
'is_open'
]],
'un_flag_abuse_for_thread'
:
[[
'vote'
,
'is_open'
]],
'undo_vote_for_thread'
:
[[
'unvote'
,
'is_open'
]],
'pin_thread'
:
[
'create_comment'
],
'un_pin_thread'
:
[
'create_comment'
],
...
...
lms/lib/comment_client/thread.py
View file @
93978da8
...
...
@@ -99,7 +99,7 @@ class Thread(models.Model):
elif
voteable
.
type
==
'comment'
:
url
=
_url_for_unflag_comment
(
voteable
.
id
)
else
:
raise
CommentClientError
(
"Can flag/unflag for threads or comments"
)
raise
CommentClientError
(
"Can
only
flag/unflag for threads or comments"
)
params
=
{
'user_id'
:
user
.
id
}
#if you're an admin, when you unflag, remove ALL flags
if
removeAll
:
...
...
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