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
c8416451
Commit
c8416451
authored
Dec 10, 2013
by
Greg Price
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1882 from edx/gprice/remove-moderator-toggle
Remove forum user profile moderator toggle button
parents
8f9f3bb9
cec58f88
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
82 deletions
+0
-82
common/static/coffee/src/discussion/user_profile.coffee
+0
-30
common/static/coffee/src/discussion/utils.coffee
+0
-1
lms/djangoapps/django_comment_client/base/urls.py
+0
-1
lms/djangoapps/django_comment_client/base/views.py
+0
-35
lms/djangoapps/django_comment_client/permissions.py
+0
-1
lms/static/sass/_discussion.scss
+0
-6
lms/templates/discussion/_user_profile.html
+0
-7
lms/templates/discussion/ajax_user_profile.html
+0
-1
No files found.
common/static/coffee/src/discussion/user_profile.coffee
deleted
100644 → 0
View file @
8f9f3bb9
if
Backbone
?
class
@
DiscussionUserProfileView
extends
Backbone
.
View
toggleModeratorStatus
:
(
event
)
->
confirmValue
=
confirm
(
"Are you sure?"
)
if
not
confirmValue
then
return
$elem
=
$
(
event
.
target
)
if
$elem
.
hasClass
(
"sidebar-promote-moderator-button"
)
isModerator
=
true
else
if
$elem
.
hasClass
(
"sidebar-revoke-moderator-button"
)
isModerator
=
false
else
console
.
error
"unrecognized moderator status"
return
url
=
DiscussionUtil
.
urlFor
(
'update_moderator_status'
,
$$profiled_user_id
)
DiscussionUtil
.
safeAjax
$elem
:
$elem
url
:
url
type
:
"POST"
dataType
:
'json'
data
:
is_moderator
:
isModerator
error
:
(
response
,
textStatus
,
e
)
->
console
.
log
e
success
:
(
response
,
textStatus
)
=>
parent
=
@
$el
.
parent
()
@
$el
.
replaceWith
(
response
.
html
)
view
=
new
DiscussionUserProfileView
el
:
parent
.
children
(
".user-profile"
)
events
:
"click .sidebar-toggle-moderator-button"
:
"toggleModeratorStatus"
common/static/coffee/src/discussion/utils.coffee
View file @
c8416451
...
...
@@ -78,7 +78,6 @@ class @DiscussionUtil
tags_autocomplete
:
"/courses/
#{
$$course_id
}
/discussion/threads/tags/autocomplete"
retrieve_discussion
:
"/courses/
#{
$$course_id
}
/discussion/forum/
#{
param
}
/inline"
retrieve_single_thread
:
"/courses/
#{
$$course_id
}
/discussion/forum/
#{
param
}
/threads/
#{
param1
}
"
update_moderator_status
:
"/courses/
#{
$$course_id
}
/discussion/users/
#{
param
}
/update_moderator_status"
openclose_thread
:
"/courses/
#{
$$course_id
}
/discussion/threads/
#{
param
}
/close"
permanent_link_thread
:
"/courses/
#{
$$course_id
}
/discussion/forum/
#{
param
}
/threads/
#{
param1
}
"
permanent_link_comment
:
"/courses/
#{
$$course_id
}
/discussion/forum/
#{
param
}
/threads/
#{
param1
}
#
#{
param2
}
"
...
...
lms/djangoapps/django_comment_client/base/urls.py
View file @
c8416451
...
...
@@ -2,7 +2,6 @@ from django.conf.urls.defaults import url, patterns
urlpatterns
=
patterns
(
'django_comment_client.base.views'
,
# nopep8
url
(
r'upload$'
,
'upload'
,
name
=
'upload'
),
url
(
r'users/(?P<user_id>\w+)/update_moderator_status$'
,
'update_moderator_status'
,
name
=
'update_moderator_status'
),
url
(
r'threads/tags/autocomplete$'
,
'tags_autocomplete'
,
name
=
'tags_autocomplete'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/update$'
,
'update_thread'
,
name
=
'update_thread'
),
url
(
r'threads/(?P<thread_id>[\w\-]+)/reply$'
,
'create_comment'
,
name
=
'create_comment'
),
...
...
lms/djangoapps/django_comment_client/base/views.py
View file @
c8416451
...
...
@@ -508,41 +508,6 @@ def unfollow_user(request, course_id, followed_user_id):
return
JsonResponse
({})
@require_POST
@login_required
@permitted
def
update_moderator_status
(
request
,
course_id
,
user_id
):
"""
given a course id and user id, check if the user has moderator
and send back a user profile
"""
is_moderator
=
request
.
POST
.
get
(
'is_moderator'
,
''
)
.
lower
()
if
is_moderator
not
in
[
"true"
,
"false"
]:
return
JsonError
(
"Must provide is_moderator as boolean value"
)
is_moderator
=
is_moderator
==
"true"
user
=
User
.
objects
.
get
(
id
=
user_id
)
role
=
Role
.
objects
.
get
(
course_id
=
course_id
,
name
=
"Moderator"
)
if
is_moderator
:
user
.
roles
.
add
(
role
)
else
:
user
.
roles
.
remove
(
role
)
if
request
.
is_ajax
():
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
discussion_user
=
cc
.
User
(
id
=
user_id
,
course_id
=
course_id
)
context
=
{
'course'
:
course
,
'course_id'
:
course_id
,
'user'
:
request
.
user
,
'django_user'
:
user
,
'profiled_user'
:
discussion_user
.
to_dict
(),
}
return
JsonResponse
({
'html'
:
render_to_string
(
'discussion/ajax_user_profile.html'
,
context
)
})
else
:
return
JsonResponse
({})
@require_GET
def
search_similar_threads
(
request
,
course_id
,
commentable_id
):
"""
...
...
lms/djangoapps/django_comment_client/permissions.py
View file @
c8416451
...
...
@@ -102,7 +102,6 @@ VIEW_PERMISSIONS = {
'unfollow_commentable'
:
[
'unfollow_commentable'
],
'unfollow_user'
:
[
'unfollow_user'
],
'create_thread'
:
[
'create_thread'
],
'update_moderator_status'
:
[
'manage_moderator'
],
}
...
...
lms/static/sass/_discussion.scss
View file @
c8416451
...
...
@@ -519,12 +519,6 @@ body.discussion {
.sidebar-comments-count
span
{
font-weight
:
700
;
}
.sidebar-toggle-moderator-button
{
@include
blue-button
;
margin-top
:
$baseline
;
text-align
:
center
;
}
}
...
...
lms/templates/discussion/_user_profile.html
View file @
c8416451
...
...
@@ -14,11 +14,4 @@
</div>
<div
class=
"sidebar-threads-count"
><span>
${profiled_user['threads_count'] | h}
</span>
${pluralize('discussion', profiled_user['threads_count']) | h} started
</div>
<div
class=
"sidebar-comments-count"
><span>
${profiled_user['comments_count'] | h}
</span>
${pluralize('comment', profiled_user['comments_count']) | h}
</div>
% if check_permissions_by_view(user, course.id, content=None, name='update_moderator_status'):
% if "Moderator" in role_names:
<a
href=
"javascript:void(0)"
class=
"sidebar-toggle-moderator-button sidebar-revoke-moderator-button"
>
${_("Revoke Moderator rights")}
</a>
% else:
<a
href=
"javascript:void(0)"
class=
"sidebar-toggle-moderator-button sidebar-promote-moderator-button"
>
${_("Promote to Moderator")}
</a>
% endif
% endif
</div>
lms/templates/discussion/ajax_user_profile.html
deleted
100644 → 0
View file @
8f9f3bb9
<
%
include
file=
"_user_profile.html"
/>
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