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
1dd0ef27
Commit
1dd0ef27
authored
Feb 06, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addressed somme comments in pull request and instructor fixes and blank group fix
parent
55c205b9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
15 deletions
+18
-15
lms/djangoapps/django_comment_client/base/views.py
+5
-3
lms/djangoapps/django_comment_client/forum/views.py
+12
-11
lms/templates/discussion/_underscore_templates.html
+1
-1
No files found.
lms/djangoapps/django_comment_client/base/views.py
View file @
1dd0ef27
...
...
@@ -109,11 +109,13 @@ def create_thread(request, course_id, commentable_id):
# else:
# regular users always post with their own id.
# group_id = user_group_id
if
'group_id'
in
post
.
keys
():
thread
.
update_attributes
(
group_id
=
post
[
'group_id'
])
group_id
=
post
.
get
(
'group_id'
)
if
group_id
:
thread
.
update_attributes
(
group_id
=
group_id
)
log
.
debug
(
"Saving thread
%
r"
,
thread
.
attributes
)
thread
.
save
()
print
thread
if
post
.
get
(
'auto_subscribe'
,
'false'
)
.
lower
()
==
'true'
:
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
.
follow
(
thread
)
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
1dd0ef27
...
...
@@ -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
*
from
course_groups.cohorts
import
is_course_cohorted
,
get_cohort_id
,
is_commentable_cohorted
,
get_cohorted_commentables
,
get_cohort
,
get_course_cohorts
,
get_cohort_by_id
from
courseware.access
import
has_access
from
urllib
import
urlencode
...
...
@@ -50,21 +50,22 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
if
not
request
.
GET
.
get
(
'sort_key'
):
# If the user did not select a sort key, use their last used sort key
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
.
retrieve
()
cc_
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
cc_
user
.
retrieve
()
# TODO: After the comment service is updated this can just be user.default_sort_key because the service returns the default value
default_query_params
[
'sort_key'
]
=
user
.
get
(
'default_sort_key'
)
or
default_query_params
[
'sort_key'
]
default_query_params
[
'sort_key'
]
=
cc_
user
.
get
(
'default_sort_key'
)
or
default_query_params
[
'sort_key'
]
else
:
# If the user clicked a sort key, update their default sort key
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
.
default_sort_key
=
request
.
GET
.
get
(
'sort_key'
)
user
.
save
()
cc_
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
cc_
user
.
default_sort_key
=
request
.
GET
.
get
(
'sort_key'
)
cc_
user
.
save
()
#if the course-user is cohorted, then add the group id
group_id
=
get_cohort_id
(
request
.
user
,
course_id
)
if
group_id
:
#if you're an instructor, show everything
if
group_id
and
not
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
):
default_query_params
[
"group_id"
]
=
group_id
query_params
=
merge_dict
(
default_query_params
,
...
...
@@ -101,8 +102,8 @@ def inline_discussion(request, course_id, discussion_id):
try
:
threads
,
query_params
=
get_threads
(
request
,
course_id
,
discussion_id
,
per_page
=
INLINE_THREADS_PER_PAGE
)
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user_info
=
user
.
to_dict
()
cc_
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user_info
=
cc_
user
.
to_dict
()
except
(
cc
.
utils
.
CommentClientError
,
cc
.
utils
.
CommentClientUnknownError
)
as
err
:
# TODO (vshnayder): since none of this code seems to be aware of the fact that
# sometimes things go wrong, I suspect that the js client is also not
...
...
@@ -132,7 +133,7 @@ def inline_discussion(request, course_id, discussion_id):
else
:
#otherwise, just make a dictionary of two
user_cohort
=
get_cohort
(
user
,
course_id
)
user_cohort
=
get_cohort
(
cc_
user
,
course_id
)
if
user_cohort
:
user_cohort_name
=
user_cohort
.
name
user_cohort_id
=
user_cohort
.
id
...
...
lms/templates/discussion/_underscore_templates.html
View file @
1dd0ef27
...
...
@@ -27,7 +27,7 @@
<
div
><
a
href
=
"javascript:void(0)"
class
=
"dogear action-follow"
data
-
tooltip
=
"follow"
><
/a></
div
>
<
header
>
$
{
"<% if (obj.group_id) { %>"
}
<
div
class
=
"group-visibility-label"
>
$
{
"<%- obj.group_string%>"
}
.
<
/div
>
<
div
class
=
"group-visibility-label"
>
$
{
"<%- obj.group_string%>"
}
<
/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