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
c28427fd
Commit
c28427fd
authored
Nov 15, 2017
by
Alex Dusenbery
Committed by
Alex Dusenbery
Nov 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EDUCATOR-1590 | Message context usernames should come from django models.
parent
926c745a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
lms/djangoapps/discussion/signals/handlers.py
+0
-2
lms/djangoapps/discussion/tasks.py
+10
-8
No files found.
lms/djangoapps/discussion/signals/handlers.py
View file @
c28427fd
...
...
@@ -54,11 +54,9 @@ def send_message(comment, site):
'comment_id'
:
comment
.
id
,
'comment_body'
:
comment
.
body
,
'comment_author_id'
:
comment
.
user_id
,
'comment_username'
:
comment
.
username
,
'comment_created_at'
:
comment
.
created_at
,
# comment_client models dates are already serialized
'thread_id'
:
thread
.
id
,
'thread_title'
:
thread
.
title
,
'thread_username'
:
thread
.
username
,
'thread_author_id'
:
thread
.
user_id
,
'thread_created_at'
:
thread
.
created_at
,
# comment_client models dates are already serialized
'thread_commentable_id'
:
thread
.
commentable_id
,
...
...
lms/djangoapps/discussion/tasks.py
View file @
c28427fd
...
...
@@ -100,17 +100,19 @@ def _get_course_language(course_id):
def
_build_message_context
(
context
):
message_context
=
get_base_template_context
(
context
[
'site'
])
message_context
.
update
(
_deserialize_context_dates
(
context
))
message_context
[
'post_link'
]
=
_get_thread_url
(
context
)
message_context
.
update
(
context
)
thread_author
=
User
.
objects
.
get
(
id
=
context
[
'thread_author_id'
])
comment_author
=
User
.
objects
.
get
(
id
=
context
[
'comment_author_id'
])
message_context
.
update
({
'thread_username'
:
thread_author
.
username
,
'comment_username'
:
comment_author
.
username
,
'post_link'
:
_get_thread_url
(
context
),
'comment_created_at'
:
date
.
deserialize
(
context
[
'comment_created_at'
]),
'thread_created_at'
:
date
.
deserialize
(
context
[
'thread_created_at'
])
})
return
message_context
def
_deserialize_context_dates
(
context
):
context
[
'comment_created_at'
]
=
date
.
deserialize
(
context
[
'comment_created_at'
])
context
[
'thread_created_at'
]
=
date
.
deserialize
(
context
[
'thread_created_at'
])
return
context
def
_get_thread_url
(
context
):
thread_content
=
{
'type'
:
'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