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
3009acbb
Commit
3009acbb
authored
Feb 04, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
showing group names
parent
69225f64
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
13 deletions
+10
-13
lms/djangoapps/django_comment_client/forum/views.py
+6
-9
lms/djangoapps/django_comment_client/utils.py
+1
-1
lms/lib/comment_client/thread.py
+2
-2
lms/templates/discussion/_underscore_templates.html
+1
-1
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
3009acbb
...
...
@@ -11,7 +11,7 @@ from django.contrib.auth.models import User
from
mitxmako.shortcuts
import
render_to_response
,
render_to_string
from
courseware.courses
import
get_course_with_access
from
course_groups.cohorts
import
get_cohort_id
,
get_course_cohorts
,
get_cohorted_commentables
,
is_course_cohorted
from
course_groups.cohorts
import
get_cohort_id
,
get_course_cohorts
,
get_cohorted_commentables
,
is_course_cohorted
,
get_cohort_by_id
from
courseware.access
import
has_access
from
urllib
import
urlencode
...
...
@@ -133,6 +133,8 @@ def forum_form_discussion(request, course_id):
for
thread
in
threads
:
courseware_context
=
get_courseware_context
(
thread
,
course
)
if
thread
.
get
(
'group_id'
)
and
not
thread
.
get
(
'group_name'
):
thread
[
'group_name'
]
=
get_cohort_by_id
(
course_id
,
thread
.
get
(
'group_id'
))
.
name
if
courseware_context
:
thread
.
update
(
courseware_context
)
if
request
.
is_ajax
():
...
...
@@ -152,10 +154,8 @@ def forum_form_discussion(request, course_id):
#trending_tags = cc.search_trending_tags(
# course_id,
#)
cohorts
=
get_course_cohorts
(
course_id
)
cohort_dictionary
=
dict
()
for
c
in
cohorts
:
cohort_dictionary
[
c
.
id
]
=
c
.
name
context
=
{
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
...
...
@@ -172,7 +172,6 @@ def forum_form_discussion(request, course_id):
'roles'
:
saxutils
.
escape
(
json
.
dumps
(
utils
.
get_role_ids
(
course_id
)),
escapedict
),
'is_moderator'
:
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
),
'cohorts'
:
cohorts
,
'cohort_map'
:
cohort_dictionary
,
'user_cohort'
:
get_cohort_id
(
user
,
course_id
),
'cohorted_commentables'
:
get_cohorted_commentables
(
course_id
),
'is_course_cohorted'
:
is_course_cohorted
(
course_id
)
...
...
@@ -189,9 +188,6 @@ def single_thread(request, course_id, discussion_id, thread_id):
try
:
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
,
user_id
=
request
.
user
.
id
)
print
(
"
\n\n\n\n\n\n
***************************"
)
print
(
"thread.get('group_id','NONE')"
)
print
(
thread
)
except
(
cc
.
utils
.
CommentClientError
,
cc
.
utils
.
CommentClientUnknownError
)
as
err
:
log
.
error
(
"Error loading single thread."
)
raise
Http404
...
...
@@ -229,6 +225,8 @@ def single_thread(request, course_id, discussion_id, thread_id):
courseware_context
=
get_courseware_context
(
thread
,
course
)
if
courseware_context
:
thread
.
update
(
courseware_context
)
if
thread
.
get
(
'group_id'
)
and
not
thread
.
get
(
'group_name'
):
thread
[
'group_name'
]
=
get_cohort_by_id
(
course_id
,
thread
.
get
(
'group_id'
))
.
name
threads
=
[
utils
.
safe_content
(
thread
)
for
thread
in
threads
]
...
...
@@ -242,7 +240,6 @@ def single_thread(request, course_id, discussion_id, thread_id):
# course_id,
#)
annotated_content_info
=
utils
.
get_metadata_for_threads
(
course_id
,
threads
,
request
.
user
,
user_info
)
context
=
{
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
3009acbb
...
...
@@ -374,7 +374,7 @@ def safe_content(content):
'updated_at'
,
'depth'
,
'type'
,
'commentable_id'
,
'comments_count'
,
'at_position_list'
,
'children'
,
'highlighted_title'
,
'highlighted_body'
,
'courseware_title'
,
'courseware_url'
,
'tags'
,
'unread_comments_count'
,
'read'
,
'group_id'
'read'
,
'group_id'
,
'group_name'
]
if
(
content
.
get
(
'anonymous'
)
is
False
)
and
(
content
.
get
(
'anonymous_to_peers'
)
is
False
):
...
...
lms/lib/comment_client/thread.py
View file @
3009acbb
...
...
@@ -10,12 +10,12 @@ class Thread(models.Model):
'closed'
,
'tags'
,
'votes'
,
'commentable_id'
,
'username'
,
'user_id'
,
'created_at'
,
'updated_at'
,
'comments_count'
,
'unread_comments_count'
,
'at_position_list'
,
'children'
,
'type'
,
'highlighted_title'
,
'highlighted_body'
,
'endorsed'
,
'read'
,
'group_id'
'highlighted_body'
,
'endorsed'
,
'read'
,
'group_id'
,
'group_name'
]
updatable_fields
=
[
'title'
,
'body'
,
'anonymous'
,
'anonymous_to_peers'
,
'course_id'
,
'closed'
,
'tags'
,
'user_id'
,
'commentable_id'
,
'group_id'
'closed'
,
'tags'
,
'user_id'
,
'commentable_id'
,
'group_id'
,
'group_name'
]
initializable_fields
=
updatable_fields
...
...
lms/templates/discussion/_underscore_templates.html
View file @
3009acbb
...
...
@@ -28,7 +28,7 @@
<
header
>
$
{
"<% if (obj.group_id) { %>"
}
<
div
class
=
"group-visibility-label"
>
This
post
visible
only
to
Group
$
{
"<%- obj.group_
id
%>"
}.
<
/div
>
<
div
class
=
"group-visibility-label"
>
This
post
visible
only
to
Group
$
{
"<%- obj.group_
name
%>"
}.
<
/div
>
$
{
"<% } %>"
}
<
a
href
=
"#"
class
=
"vote-btn discussion-vote discussion-vote-up"
data
-
role
=
"discussion-vote"
data
-
tooltip
=
"vote"
><
span
class
=
"plus-icon"
>+<
/span> <span class='votes-count-number'>${'<%- votes
[
"up_count"
]
%>'}</
span
><
/a
>
...
...
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