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
70b0b5be
Commit
70b0b5be
authored
Dec 06, 2012
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update models
parent
4139f702
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
15 deletions
+22
-15
lms/djangoapps/django_comment_client/base/urls.py
+1
-1
lms/djangoapps/django_comment_client/base/views.py
+8
-8
lms/lib/comment_client/thread.py
+9
-3
lms/static/coffee/src/discussion/views/discussion_thread_show_view.coffee
+1
-1
lms/templates/discussion/_underscore_templates.html
+3
-2
No files found.
lms/djangoapps/django_comment_client/base/urls.py
View file @
70b0b5be
...
...
@@ -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\-]+)/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\-]+)/flagAbuse$'
,
'flag_abuse_for_thread'
,
{
'value'
:
'up'
},
name
=
'flag_abuse_for_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/flagAbuse$'
,
'flag_abuse_for_thread'
,
name
=
'flag_abuse_for_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/unFlagAbuse$'
,
'un_flag_abuse_for_thread'
,
name
=
'un_flag_abuse_for_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/downvote$'
,
'vote_for_thread'
,
name
=
'downvote_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/unvote$'
,
'undo_vote_for_thread'
,
name
=
'undo_vote_for_thread'
),
...
...
lms/djangoapps/django_comment_client/base/views.py
View file @
70b0b5be
...
...
@@ -238,28 +238,28 @@ def vote_for_thread(request, course_id, thread_id, value):
@require_POST
@login_required
@permitted
def
flag_abuse_for_thread
(
request
,
course_id
,
thread_id
,
value
):
def
flag_abuse_for_thread
(
request
,
course_id
,
thread_id
):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
thread
.
flagAbuse
(
user
,
thread
,
value
)
thread
.
flagAbuse
(
user
,
thread
)
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()))
def
un_flag_abuse_for_thread
(
request
,
course_id
,
thread_id
,
value
):
def
un_flag_abuse_for_thread
(
request
,
course_id
,
thread_id
):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
thread
.
unFlagAbuse
(
user
,
thread
,
value
)
thread
.
unFlagAbuse
(
user
,
thread
)
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()))
def
flag_abuse_for_comment
(
request
,
course_id
,
comment_id
,
value
):
def
flag_abuse_for_comment
(
request
,
course_id
,
comment_id
):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
comment
=
cc
.
Comment
.
find
(
thread_id
)
comment
.
flagAbuse
(
user
,
comment
,
value
)
comment
.
flagAbuse
(
user
,
comment
)
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()))
def
un_flag_abuse_for_comment
(
request
,
course_id
,
comment_id
,
value
):
def
un_flag_abuse_for_comment
(
request
,
course_id
,
comment_id
):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
comment
=
cc
.
Comment
.
find
(
thread_id
)
comment
.
unFlagAbuse
(
user
,
comment
,
value
)
comment
.
unFlagAbuse
(
user
,
comment
)
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()))
@require_POST
...
...
lms/lib/comment_client/thread.py
View file @
70b0b5be
...
...
@@ -72,8 +72,14 @@ class Thread(models.Model):
'mark_as_read'
:
kwargs
.
get
(
'mark_as_read'
,
True
),
}
def
flagAbuse
(
self
,
user
,
voteable
,
value
):
# user_id may be none, in which case it shouldn't be part of the
# request.
request_params
=
strip_none
(
request_params
)
response
=
perform_request
(
'get'
,
url
,
request_params
)
self
.
update_attributes
(
**
response
)
def
flagAbuse
(
self
,
user
,
voteable
):
if
voteable
.
type
==
'thread'
:
url
=
_url_for_flag_abuse_thread
(
voteable
.
id
)
elif
voteable
.
type
==
'comment'
:
...
...
@@ -84,7 +90,7 @@ class Thread(models.Model):
request
=
perform_request
(
'put'
,
url
,
params
)
voteable
.
update_attributes
(
request
)
def
unFlagAbuse
(
self
,
user
,
voteable
,
value
):
def
unFlagAbuse
(
self
,
user
,
voteable
):
if
voteable
.
type
==
'thread'
:
url
=
_url_for_unflag_abuse_thread
(
voteable
.
id
)
elif
voteable
.
type
==
'comment'
:
...
...
lms/static/coffee/src/discussion/views/discussion_thread_show_view.coffee
View file @
70b0b5be
...
...
@@ -72,7 +72,7 @@ if Backbone?
toggleFollowing
:
(
event
)
->
$elem
=
$
(
event
.
target
)
url
=
nullunF
lagAbuse
:
->
url
=
nullunF
ollow
:
->
url
=
@
model
.
urlFor
(
"unFlagAbuse"
)
DiscussionUtil
.
safeAjax
$elem
:
@
$
(
".discussion-flag-abuse"
)
...
...
lms/templates/discussion/_underscore_templates.html
View file @
70b0b5be
...
...
@@ -44,7 +44,7 @@
<
/header
>
<
div
class
=
"post-body"
>
$
{
'<%- body %>'
}
<
/div
>
POST
<
div
class
=
"discussion-flag-abuse notflagged"
data
-
role
=
"thread-flag"
data
-
tooltip
=
"flag"
>
<
i
class
=
"icon"
><
/i><span class="flag-label">Report Misuse</
span
><
/div>
...
...
@@ -111,7 +111,7 @@
<
p
class
=
"posted-details"
title
=
"${'<%- created_at %>'}"
>
$
{
'<%- created_at %>'
}
<
/p
>
<
/header
>
<
div
class
=
"response-local"
><
div
class
=
"response-body"
>
$
{
"<%- body %>"
}
<
/div
>
RESPONSE
<
div
class
=
"discussion-flag-abuse notflagged"
data
-
role
=
"thread-flag"
data
-
tooltip
=
"flag"
>
<
i
class
=
"icon"
><
/i><span class="flag-label">Report Misuse</
span
><
/div
>
<
/div
>
...
...
@@ -137,6 +137,7 @@
<script
type=
"text/template"
id=
"response-comment-show-template"
>
<
div
id
=
"comment_${'<%- id %>'}"
>
<
div
class
=
"response-body"
>
$
{
'<%- body %>'
}
<
/div
>
COMMENT
<
div
class
=
"discussion-flag-abuse notflagged"
data
-
role
=
"thread-flag"
data
-
tooltip
=
"flag"
>
<
i
class
=
"icon"
><
/i><span class="flag-label">Report Misuse</
span
><
/div>
<
p
class
=
"posted-details"
>&
ndash
;
posted
<
span
class
=
"timeago"
title
=
"${'<%- created_at %>'}"
>
$
{
'<%- created_at %>'
}
<
/span> b
y
...
...
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