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
0e8ef283
Commit
0e8ef283
authored
Apr 05, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flagging almost done
parent
daa0cd22
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
9 deletions
+16
-9
common/static/coffee/src/discussion/views/discussion_thread_show_view.coffee
+1
-1
distribute-0.6.32.tar.gz
+0
-0
distribute-0.6.34.tar.gz
+0
-0
lms/djangoapps/django_comment_client/base/views.py
+3
-1
lms/djangoapps/django_comment_client/forum/views.py
+2
-2
lms/djangoapps/django_comment_client/utils.py
+2
-1
lms/lib/comment_client/comment.py
+1
-1
lms/lib/comment_client/thread.py
+7
-3
No files found.
common/static/coffee/src/discussion/views/discussion_thread_show_view.coffee
View file @
0e8ef283
...
@@ -46,7 +46,7 @@ if Backbone?
...
@@ -46,7 +46,7 @@ if Backbone?
@
$
(
"[data-role=discussion-vote]"
).
removeClass
(
"is-cast"
)
@
$
(
"[data-role=discussion-vote]"
).
removeClass
(
"is-cast"
)
renderFlagged
:
=>
renderFlagged
:
=>
if
window
.
user
.
id
in
@
model
.
get
(
"abuse_flaggers"
)
if
window
.
user
.
id
in
@
model
.
get
(
"abuse_flaggers"
)
or
@
model
.
get
(
"show_any_flag"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
addClass
(
"flagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"notflagged"
)
@
$
(
"[data-role=thread-flag]"
).
removeClass
(
"notflagged"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
"Misuse Reported"
)
@
$
(
".discussion-flag-abuse .flag-label"
).
html
(
"Misuse Reported"
)
...
...
distribute-0.6.32.tar.gz
deleted
100644 → 0
View file @
daa0cd22
File deleted
distribute-0.6.34.tar.gz
deleted
100644 → 0
View file @
daa0cd22
File deleted
lms/djangoapps/django_comment_client/base/views.py
View file @
0e8ef283
...
@@ -295,8 +295,10 @@ def flag_abuse_for_thread(request, course_id, thread_id):
...
@@ -295,8 +295,10 @@ def flag_abuse_for_thread(request, course_id, thread_id):
def
un_flag_abuse_for_thread
(
request
,
course_id
,
thread_id
):
def
un_flag_abuse_for_thread
(
request
,
course_id
,
thread_id
):
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
.
unFlagAbuse
(
user
,
thread
)
removeAll
=
cached_has_permission
(
request
.
user
,
'openclose_thread'
,
course_id
)
thread
.
unFlagAbuse
(
user
,
thread
,
removeAll
)
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()))
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()))
def
flag_abuse_for_comment
(
request
,
course_id
,
comment_id
):
def
flag_abuse_for_comment
(
request
,
course_id
,
comment_id
):
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
0e8ef283
...
@@ -242,13 +242,12 @@ def single_thread(request, course_id, discussion_id, thread_id):
...
@@ -242,13 +242,12 @@ def single_thread(request, course_id, discussion_id, thread_id):
try
:
try
:
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
,
user_id
=
request
.
user
.
id
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
,
user_id
=
request
.
user
.
id
)
thread
[
'show_any_flag'
]
=
cached_has_permission
(
request
.
user
,
'openclose_thread'
,
course
.
id
)
and
thread
[
'abuse_flaggers'
]
and
len
(
thread
[
'abuse_flaggers'
])
>
0
except
(
cc
.
utils
.
CommentClientError
,
cc
.
utils
.
CommentClientUnknownError
)
as
err
:
except
(
cc
.
utils
.
CommentClientError
,
cc
.
utils
.
CommentClientUnknownError
)
as
err
:
log
.
error
(
"Error loading single thread."
)
log
.
error
(
"Error loading single thread."
)
raise
Http404
raise
Http404
if
request
.
is_ajax
():
if
request
.
is_ajax
():
courseware_context
=
get_courseware_context
(
thread
,
course
)
courseware_context
=
get_courseware_context
(
thread
,
course
)
annotated_content_info
=
utils
.
get_annotated_content_infos
(
course_id
,
thread
,
request
.
user
,
user_info
=
user_info
)
annotated_content_info
=
utils
.
get_annotated_content_infos
(
course_id
,
thread
,
request
.
user
,
user_info
=
user_info
)
context
=
{
'thread'
:
thread
.
to_dict
(),
'course_id'
:
course_id
}
context
=
{
'thread'
:
thread
.
to_dict
(),
'course_id'
:
course_id
}
...
@@ -321,6 +320,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
...
@@ -321,6 +320,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
'thread_pages'
:
query_params
[
'num_pages'
],
'thread_pages'
:
query_params
[
'num_pages'
],
'is_course_cohorted'
:
is_course_cohorted
(
course_id
),
'is_course_cohorted'
:
is_course_cohorted
(
course_id
),
'is_moderator'
:
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
),
'is_moderator'
:
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
),
'flag_moderator'
:
cached_has_permission
(
request
.
user
,
'openclose_thread'
,
course
.
id
),
'cohorts'
:
cohorts
,
'cohorts'
:
cohorts
,
'user_cohort'
:
get_cohort_id
(
request
.
user
,
course_id
),
'user_cohort'
:
get_cohort_id
(
request
.
user
,
course_id
),
'cohorted_commentables'
:
cohorted_commentables
'cohorted_commentables'
:
cohorted_commentables
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
0e8ef283
...
@@ -409,7 +409,8 @@ def safe_content(content):
...
@@ -409,7 +409,8 @@ def safe_content(content):
'updated_at'
,
'depth'
,
'type'
,
'commentable_id'
,
'comments_count'
,
'updated_at'
,
'depth'
,
'type'
,
'commentable_id'
,
'comments_count'
,
'at_position_list'
,
'children'
,
'highlighted_title'
,
'highlighted_body'
,
'at_position_list'
,
'children'
,
'highlighted_title'
,
'highlighted_body'
,
'courseware_title'
,
'courseware_url'
,
'tags'
,
'unread_comments_count'
,
'courseware_title'
,
'courseware_url'
,
'tags'
,
'unread_comments_count'
,
'read'
,
'group_id'
,
'group_name'
,
'group_string'
,
'pinned'
,
'abuse_flaggers'
'read'
,
'group_id'
,
'group_name'
,
'group_string'
,
'pinned'
,
'abuse_flaggers'
,
'show_any_flag'
]
]
if
(
content
.
get
(
'anonymous'
)
is
False
)
and
(
content
.
get
(
'anonymous_to_peers'
)
is
False
):
if
(
content
.
get
(
'anonymous'
)
is
False
)
and
(
content
.
get
(
'anonymous_to_peers'
)
is
False
):
...
...
lms/lib/comment_client/comment.py
View file @
0e8ef283
...
@@ -11,7 +11,7 @@ class Comment(models.Model):
...
@@ -11,7 +11,7 @@ class Comment(models.Model):
'id'
,
'body'
,
'anonymous'
,
'anonymous_to_peers'
,
'course_id'
,
'id'
,
'body'
,
'anonymous'
,
'anonymous_to_peers'
,
'course_id'
,
'endorsed'
,
'parent_id'
,
'thread_id'
,
'username'
,
'votes'
,
'user_id'
,
'endorsed'
,
'parent_id'
,
'thread_id'
,
'username'
,
'votes'
,
'user_id'
,
'closed'
,
'created_at'
,
'updated_at'
,
'depth'
,
'at_position_list'
,
'closed'
,
'created_at'
,
'updated_at'
,
'depth'
,
'at_position_list'
,
'type'
,
'commentable_id'
,
'abuse_flaggers'
'type'
,
'commentable_id'
,
'abuse_flaggers'
,
'show_any_flag'
]
]
updatable_fields
=
[
updatable_fields
=
[
...
...
lms/lib/comment_client/thread.py
View file @
0e8ef283
from
.utils
import
*
from
.utils
import
*
import
models
import
models
import
settings
import
settings
...
@@ -11,7 +10,8 @@ class Thread(models.Model):
...
@@ -11,7 +10,8 @@ class Thread(models.Model):
'closed'
,
'tags'
,
'votes'
,
'commentable_id'
,
'username'
,
'user_id'
,
'closed'
,
'tags'
,
'votes'
,
'commentable_id'
,
'username'
,
'user_id'
,
'created_at'
,
'updated_at'
,
'comments_count'
,
'unread_comments_count'
,
'created_at'
,
'updated_at'
,
'comments_count'
,
'unread_comments_count'
,
'at_position_list'
,
'children'
,
'type'
,
'highlighted_title'
,
'at_position_list'
,
'children'
,
'type'
,
'highlighted_title'
,
'highlighted_body'
,
'endorsed'
,
'read'
,
'group_id'
,
'group_name'
,
'pinned'
,
'abuse_flaggers'
'highlighted_body'
,
'endorsed'
,
'read'
,
'group_id'
,
'group_name'
,
'pinned'
,
'abuse_flaggers'
,
'show_any_flag'
]
]
updatable_fields
=
[
updatable_fields
=
[
...
@@ -93,7 +93,7 @@ class Thread(models.Model):
...
@@ -93,7 +93,7 @@ class Thread(models.Model):
request
=
perform_request
(
'put'
,
url
,
params
)
request
=
perform_request
(
'put'
,
url
,
params
)
voteable
.
update_attributes
(
request
)
voteable
.
update_attributes
(
request
)
def
unFlagAbuse
(
self
,
user
,
voteable
):
def
unFlagAbuse
(
self
,
user
,
voteable
,
removeAll
):
if
voteable
.
type
==
'thread'
:
if
voteable
.
type
==
'thread'
:
url
=
_url_for_unflag_abuse_thread
(
voteable
.
id
)
url
=
_url_for_unflag_abuse_thread
(
voteable
.
id
)
elif
voteable
.
type
==
'comment'
:
elif
voteable
.
type
==
'comment'
:
...
@@ -101,6 +101,10 @@ class Thread(models.Model):
...
@@ -101,6 +101,10 @@ class Thread(models.Model):
else
:
else
:
raise
CommentClientError
(
"Can flag/unflag for threads or comments"
)
raise
CommentClientError
(
"Can flag/unflag for threads or comments"
)
params
=
{
'user_id'
:
user
.
id
}
params
=
{
'user_id'
:
user
.
id
}
#if you're an admin, when you unflag, remove ALL flags
if
removeAll
:
params
[
'all'
]
=
True
request
=
perform_request
(
'put'
,
url
,
params
)
request
=
perform_request
(
'put'
,
url
,
params
)
voteable
.
update_attributes
(
request
)
voteable
.
update_attributes
(
request
)
...
...
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