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
4b017e71
Commit
4b017e71
authored
Nov 20, 2012
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated models and vies f for flagging
parent
57b70092
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
11 deletions
+20
-11
lms/djangoapps/django_comment_client/base/urls.py
+1
-1
lms/djangoapps/django_comment_client/base/views.py
+1
-1
lms/djangoapps/django_comment_client/permissions.py
+2
-2
lms/lib/comment_client/thread.py
+16
-7
No files found.
lms/djangoapps/django_comment_client/base/urls.py
View file @
4b017e71
...
@@ -10,7 +10,7 @@ urlpatterns = patterns('django_comment_client.base.views',
...
@@ -10,7 +10,7 @@ urlpatterns = patterns('django_comment_client.base.views',
url
(
r'threads/(?P<thread_id>[\w\-]+)/reply$'
,
'create_comment'
,
name
=
'create_comment'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/reply$'
,
'create_comment'
,
name
=
'create_comment'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/delete'
,
'delete_thread'
,
name
=
'delete_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/delete'
,
'delete_thread'
,
name
=
'delete_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/upvote$'
,
'vote_for_thread'
,
{
'value'
:
'up'
},
name
=
'upvote_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/upvote$'
,
'vote_for_thread'
,
{
'value'
:
'up'
},
name
=
'upvote_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/flagAbuse$'
,
'flag_abuse_for_thread'
,
{
'value'
:
'up'
},
name
=
'flag_abuse_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/flagAbuse$'
,
'flag_abuse_for_thread'
,
{
'value'
:
'up'
},
name
=
'flag_abuse_
for_
thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/downvote$'
,
'vote_for_thread'
,
{
'value'
:
'down'
},
name
=
'downvote_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/downvote$'
,
'vote_for_thread'
,
{
'value'
:
'down'
},
name
=
'downvote_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/unvote$'
,
'undo_vote_for_thread'
,
name
=
'undo_vote_for_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/unvote$'
,
'undo_vote_for_thread'
,
name
=
'undo_vote_for_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/follow$'
,
'follow_thread'
,
name
=
'follow_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/follow$'
,
'follow_thread'
,
name
=
'follow_thread'
),
...
...
lms/djangoapps/django_comment_client/base/views.py
View file @
4b017e71
...
@@ -241,7 +241,7 @@ def vote_for_thread(request, course_id, thread_id, value):
...
@@ -241,7 +241,7 @@ def vote_for_thread(request, course_id, thread_id, value):
def
flag_abuse_for_thread
(
request
,
course_id
,
thread_id
,
value
):
def
flag_abuse_for_thread
(
request
,
course_id
,
thread_id
,
value
):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
thread
.
flagAbuse
(
thread
,
value
)
thread
.
flagAbuse
(
user
,
thread
,
value
)
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()))
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()))
@require_POST
@require_POST
...
...
lms/djangoapps/django_comment_client/permissions.py
View file @
4b017e71
...
@@ -69,8 +69,8 @@ def check_conditions_permissions(user, permissions, course_id, **kwargs):
...
@@ -69,8 +69,8 @@ def check_conditions_permissions(user, permissions, course_id, **kwargs):
return
True
in
results
return
True
in
results
elif
operator
==
"and"
:
elif
operator
==
"and"
:
return
not
False
in
results
return
not
False
in
results
return
True
return
test
(
user
,
permissions
,
operator
=
"or"
)
#
return test(user, permissions, operator="or")
VIEW_PERMISSIONS
=
{
VIEW_PERMISSIONS
=
{
...
...
lms/lib/comment_client/thread.py
View file @
4b017e71
...
@@ -71,10 +71,19 @@ class Thread(models.Model):
...
@@ -71,10 +71,19 @@ class Thread(models.Model):
'user_id'
:
kwargs
.
get
(
'user_id'
),
'user_id'
:
kwargs
.
get
(
'user_id'
),
'mark_as_read'
:
kwargs
.
get
(
'mark_as_read'
,
True
),
'mark_as_read'
:
kwargs
.
get
(
'mark_as_read'
,
True
),
}
}
# user_id may be none, in which case it shouldn't be part of the
# request.
def
flagAbuse
(
self
,
user
,
voteable
,
value
):
request_params
=
strip_none
(
request_params
)
if
voteable
.
type
==
'thread'
:
url
=
_url_for_flag_abuse_thread
(
voteable
.
id
)
response
=
perform_request
(
'get'
,
url
,
request_params
)
elif
voteable
.
type
==
'comment'
:
self
.
update_attributes
(
**
response
)
url
=
_url_for_vote_comment
(
voteable
.
id
)
else
:
raise
CommentClientError
(
"Can only vote / unvote for threads or comments"
)
params
=
{
'user_id'
:
user
.
id
,
'value'
:
value
}
request
=
perform_request
(
'put'
,
url
,
params
)
voteable
.
update_attributes
(
request
)
def
_url_for_flag_abuse_thread
(
thread_id
):
return
"{prefix}/threads/{thread_id}/abuse_flags"
.
format
(
prefix
=
settings
.
PREFIX
,
thread_id
=
thread_id
)
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