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
fe9b1a0d
Commit
fe9b1a0d
authored
Feb 04, 2016
by
wajeeha-khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add analytics event to thread/comment vote
parent
d8084564
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
lms/djangoapps/discussion_api/api.py
+7
-5
lms/djangoapps/discussion_api/tests/utils.py
+1
-0
No files found.
lms/djangoapps/discussion_api/api.py
View file @
fe9b1a0d
...
...
@@ -9,6 +9,7 @@ from django.core.exceptions import ValidationError
from
django.core.urlresolvers
import
reverse
from
django.http
import
Http404
import
itertools
from
lms.djangoapps.django_comment_client.base.views
import
track_voted_event
from
rest_framework.exceptions
import
PermissionDenied
...
...
@@ -496,7 +497,7 @@ def _check_editable_fields(cc_content, data, context):
)
def
_do_extra_actions
(
api_content
,
cc_content
,
request_fields
,
actions_form
,
context
):
def
_do_extra_actions
(
api_content
,
cc_content
,
request_fields
,
actions_form
,
context
,
request
):
"""
Perform any necessary additional actions related to content creation or
update that require a separate comments service request.
...
...
@@ -524,6 +525,7 @@ def _do_extra_actions(api_content, cc_content, request_fields, actions_form, con
else
:
context
[
"cc_requester"
]
.
unvote
(
cc_content
)
api_content
[
"vote_count"
]
-=
1
track_voted_event
(
request
,
context
[
"course"
],
cc_content
,
"up"
,
False
if
form_value
else
True
)
def
create_thread
(
request
,
thread_data
):
...
...
@@ -568,7 +570,7 @@ def create_thread(request, thread_data):
cc_thread
=
serializer
.
instance
thread_created
.
send
(
sender
=
None
,
user
=
user
,
post
=
cc_thread
)
api_thread
=
serializer
.
data
_do_extra_actions
(
api_thread
,
cc_thread
,
thread_data
.
keys
(),
actions_form
,
context
)
_do_extra_actions
(
api_thread
,
cc_thread
,
thread_data
.
keys
(),
actions_form
,
context
,
request
)
track_thread_created_event
(
request
,
course
,
cc_thread
,
actions_form
.
cleaned_data
[
"following"
])
...
...
@@ -609,7 +611,7 @@ def create_comment(request, comment_data):
cc_comment
=
serializer
.
instance
comment_created
.
send
(
sender
=
None
,
user
=
request
.
user
,
post
=
cc_comment
)
api_comment
=
serializer
.
data
_do_extra_actions
(
api_comment
,
cc_comment
,
comment_data
.
keys
(),
actions_form
,
context
)
_do_extra_actions
(
api_comment
,
cc_comment
,
comment_data
.
keys
(),
actions_form
,
context
,
request
)
track_comment_created_event
(
request
,
context
[
"course"
],
cc_comment
,
cc_thread
[
"commentable_id"
],
followed
=
False
)
...
...
@@ -646,7 +648,7 @@ def update_thread(request, thread_id, update_data):
# signal to update Teams when a user edits a thread
thread_edited
.
send
(
sender
=
None
,
user
=
request
.
user
,
post
=
cc_thread
)
api_thread
=
serializer
.
data
_do_extra_actions
(
api_thread
,
cc_thread
,
update_data
.
keys
(),
actions_form
,
context
)
_do_extra_actions
(
api_thread
,
cc_thread
,
update_data
.
keys
(),
actions_form
,
context
,
request
)
return
api_thread
...
...
@@ -690,7 +692,7 @@ def update_comment(request, comment_id, update_data):
serializer
.
save
()
comment_edited
.
send
(
sender
=
None
,
user
=
request
.
user
,
post
=
cc_comment
)
api_comment
=
serializer
.
data
_do_extra_actions
(
api_comment
,
cc_comment
,
update_data
.
keys
(),
actions_form
,
context
)
_do_extra_actions
(
api_comment
,
cc_comment
,
update_data
.
keys
(),
actions_form
,
context
,
request
)
return
api_comment
...
...
lms/djangoapps/discussion_api/tests/utils.py
View file @
fe9b1a0d
...
...
@@ -358,6 +358,7 @@ def make_minimal_cs_comment(overrides=None):
ret
=
{
"type"
:
"comment"
,
"id"
:
"dummy"
,
"commentable_id"
:
"dummy"
,
"thread_id"
:
"dummy"
,
"parent_id"
:
None
,
"user_id"
:
"0"
,
...
...
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