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
3761b02c
Commit
3761b02c
authored
Aug 23, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hide reply button after closing thread
parent
575a91e2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
lms/djangoapps/django_comment_client/base/views.py
+5
-1
lms/djangoapps/django_comment_client/utils.py
+11
-8
lms/static/coffee/src/discussion/content.coffee
+4
-1
No files found.
lms/djangoapps/django_comment_client/base/views.py
View file @
3761b02c
...
...
@@ -156,7 +156,11 @@ def openclose_thread(request, course_id, thread_id):
thread
=
cc
.
Thread
.
find
(
thread_id
)
thread
.
closed
=
request
.
POST
.
get
(
'closed'
,
'false'
)
.
lower
()
==
'true'
thread
.
save
()
return
JsonResponse
(
thread
.
to_dict
())
thread
=
thread
.
to_dict
()
return
JsonResponse
({
'content'
:
thread
,
'ability'
:
utils
.
get_ability
(
course_id
,
thread
,
request
.
user
),
})
@require_POST
@login_required
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
3761b02c
...
...
@@ -164,6 +164,16 @@ class QueryCountDebugMiddleware(object):
logging
.
info
(
'
%
s queries run, total
%
s seconds'
%
(
len
(
connection
.
queries
),
total_time
))
return
response
def
get_ability
(
course_id
,
content
,
user
):
return
{
'editable'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"update_thread"
if
content
[
'type'
]
==
'thread'
else
"update_comment"
),
'can_reply'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"create_comment"
if
content
[
'type'
]
==
'thread'
else
"create_sub_comment"
),
'can_endorse'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"endorse_comment"
)
if
content
[
'type'
]
==
'comment'
else
False
,
'can_delete'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"delete_thread"
if
content
[
'type'
]
==
'thread'
else
"delete_comment"
),
'can_openclose'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"openclose_thread"
)
if
content
[
'type'
]
==
'thread'
else
False
,
'can_vote'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"vote_for_thread"
if
content
[
'type'
]
==
'thread'
else
"vote_for_comment"
),
}
def
get_annotated_content_info
(
course_id
,
content
,
user
,
user_info
):
voted
=
''
if
content
[
'id'
]
in
user_info
[
'upvoted_ids'
]:
...
...
@@ -173,14 +183,7 @@ def get_annotated_content_info(course_id, content, user, user_info):
return
{
'voted'
:
voted
,
'subscribed'
:
content
[
'id'
]
in
user_info
[
'subscribed_thread_ids'
],
'ability'
:
{
'editable'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"update_thread"
if
content
[
'type'
]
==
'thread'
else
"update_comment"
),
'can_reply'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"create_comment"
if
content
[
'type'
]
==
'thread'
else
"create_sub_comment"
),
'can_endorse'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"endorse_comment"
)
if
content
[
'type'
]
==
'comment'
else
False
,
'can_delete'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"delete_thread"
if
content
[
'type'
]
==
'thread'
else
"delete_comment"
),
'can_openclose'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"openclose_thread"
)
if
content
[
'type'
]
==
'thread'
else
False
,
'can_vote'
:
check_permissions_by_view
(
user
,
course_id
,
content
,
"vote_for_thread"
if
content
[
'type'
]
==
'thread'
else
"vote_for_comment"
),
},
'ability'
:
get_ability
(
course_id
,
content
,
user
),
}
def
get_annotated_content_infos
(
course_id
,
thread
,
user
,
user_info
):
...
...
lms/static/coffee/src/discussion/content.coffee
View file @
3761b02c
...
...
@@ -90,7 +90,9 @@ if Backbone?
ability
:
(
ability
)
->
for
action
,
elemSelector
of
@
model
.
actions
if
not
ability
[
action
]
@
$
(
elemSelector
).
parent
().
remove
()
@
$
(
elemSelector
).
parent
().
hide
()
else
@
$
(
elemSelector
).
parent
().
show
()
$discussionContent
:
->
@
_discussionContent
||=
@
$el
.
children
(
".discussion-content"
)
...
...
@@ -271,6 +273,7 @@ if Backbone?
data
:
data
success
:
(
response
,
textStatus
)
=>
@
model
.
set
(
'closed'
,
not
closed
)
@
model
.
set
(
'ability'
,
response
.
ability
)
edit
:
(
event
)
->
@
$
(
".discussion-content-wrapper"
).
hide
()
...
...
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