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
1c1d449a
Commit
1c1d449a
authored
Aug 18, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor refactoring
parent
0dd5428e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
lms/djangoapps/django_comment_client/base/views.py
+13
-10
No files found.
lms/djangoapps/django_comment_client/base/views.py
View file @
1c1d449a
...
...
@@ -64,10 +64,12 @@ def ajax_content_response(request, course_id, content, template_name):
def
create_thread
(
request
,
course_id
,
commentable_id
):
post
=
request
.
POST
thread
=
cc
.
Thread
(
**
extract
(
post
,
[
'body'
,
'title'
,
'tags'
]))
thread
.
anonymous
=
post
.
get
(
'anonymous'
,
'false'
)
.
lower
()
==
'true'
thread
.
commentable_id
=
commentable_id
thread
.
course_id
=
course_id
thread
.
user_id
=
request
.
user
.
id
thread
.
update_attributes
({
'anonymous'
:
post
.
get
(
'anonymous'
,
'false'
)
.
lower
()
==
'true'
,
'commentable_id'
:
commentable_id
,
'course_id'
:
course_id
,
'user_id'
:
request
.
user
.
id
,
})
thread
.
save
()
if
post
.
get
(
'auto_subscribe'
,
'false'
)
.
lower
()
==
'true'
:
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
...
...
@@ -92,13 +94,14 @@ def update_thread(request, course_id, thread_id):
def
_create_comment
(
request
,
course_id
,
thread_id
=
None
,
parent_id
=
None
):
post
=
request
.
POST
comment
=
cc
.
Comment
(
**
extract
(
post
,
[
'body'
]))
comment
.
anonymous
=
post
.
get
(
'anonymous'
,
'false'
)
.
lower
()
==
'true'
comment
.
user_id
=
request
.
user
.
id
comment
.
course_id
=
course_id
comment
.
thread_id
=
thread_id
comment
.
parent_id
=
parent_id
comment
.
update_attributes
({
'anonymous'
:
post
.
get
(
'anonymous'
,
'false'
)
.
lower
()
==
'true'
,
'user_id'
:
request
.
user
.
id
,
'course_id'
:
course_id
,
'thread_id'
:
thread_id
,
'parent_id'
:
parent_id
,
})
comment
.
save
()
dict_comment
=
comment
.
to_dict
()
if
post
.
get
(
'auto_subscribe'
,
'false'
)
.
lower
()
==
'true'
:
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
.
follow
(
comment
.
thread
)
...
...
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