Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
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
cs_comments_service
Commits
07893a27
Commit
07893a27
authored
Apr 06, 2016
by
wajeeha-khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return thread's last_activity_at in response object for thread endpoints
parent
39cc391e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
models/comment_thread.rb
+1
-1
spec/spec_helper.rb
+3
-1
No files found.
models/comment_thread.rb
View file @
07893a27
...
@@ -122,7 +122,7 @@ class CommentThread < Content
...
@@ -122,7 +122,7 @@ class CommentThread < Content
end
end
def
to_hash
(
params
=
{})
def
to_hash
(
params
=
{})
as_document
.
slice
(
*
%w[thread_type title body course_id anonymous anonymous_to_peers commentable_id created_at updated_at at_position_list closed context]
)
as_document
.
slice
(
*
%w[thread_type title body course_id anonymous anonymous_to_peers commentable_id created_at updated_at at_position_list closed context
last_activity_at
]
)
.
merge
(
'id'
=>
_id
,
.
merge
(
'id'
=>
_id
,
'user_id'
=>
author_id
,
'user_id'
=>
author_id
,
'username'
=>
author_username
,
'username'
=>
author_username
,
...
...
spec/spec_helper.rb
View file @
07893a27
...
@@ -162,7 +162,7 @@ def check_thread_result(user, thread, hash, is_json=false)
...
@@ -162,7 +162,7 @@ def check_thread_result(user, thread, hash, is_json=false)
expected_keys
=
%w(id thread_type title body course_id commentable_id created_at updated_at context)
expected_keys
=
%w(id thread_type title body course_id commentable_id created_at updated_at context)
expected_keys
+=
%w(anonymous anonymous_to_peers at_position_list closed user_id)
expected_keys
+=
%w(anonymous anonymous_to_peers at_position_list closed user_id)
expected_keys
+=
%w(username votes abuse_flaggers tags type group_id pinned)
expected_keys
+=
%w(username votes abuse_flaggers tags type group_id pinned)
expected_keys
+=
%w(comments_count unread_comments_count read endorsed)
expected_keys
+=
%w(comments_count unread_comments_count read endorsed
last_activity_at
)
# these keys are checked separately, when desired, using check_thread_response_paging.
# these keys are checked separately, when desired, using check_thread_response_paging.
actual_keys
=
hash
.
keys
-
[
actual_keys
=
hash
.
keys
-
[
"children"
,
"endorsed_responses"
,
"non_endorsed_responses"
,
"resp_skip"
,
"children"
,
"endorsed_responses"
,
"non_endorsed_responses"
,
"resp_skip"
,
...
@@ -197,9 +197,11 @@ def check_thread_result(user, thread, hash, is_json=false)
...
@@ -197,9 +197,11 @@ def check_thread_result(user, thread, hash, is_json=false)
hash
[
"id"
].
should
==
thread
.
_id
.
to_s
hash
[
"id"
].
should
==
thread
.
_id
.
to_s
hash
[
"created_at"
].
should
==
thread
.
created_at
.
utc
.
strftime
(
"%Y-%m-%dT%H:%M:%SZ"
)
hash
[
"created_at"
].
should
==
thread
.
created_at
.
utc
.
strftime
(
"%Y-%m-%dT%H:%M:%SZ"
)
hash
[
"updated_at"
].
should
==
thread
.
updated_at
.
utc
.
strftime
(
"%Y-%m-%dT%H:%M:%SZ"
)
hash
[
"updated_at"
].
should
==
thread
.
updated_at
.
utc
.
strftime
(
"%Y-%m-%dT%H:%M:%SZ"
)
hash
[
"last_activity_at"
].
should
==
thread
.
last_activity_at
.
utc
.
strftime
(
"%Y-%m-%dT%H:%M:%SZ"
)
else
else
hash
[
"created_at"
].
should
==
thread
.
created_at
hash
[
"created_at"
].
should
==
thread
.
created_at
hash
[
"updated_at"
].
should
==
thread
.
updated_at
hash
[
"updated_at"
].
should
==
thread
.
updated_at
hash
[
"last_activity_at"
].
should
==
thread
.
last_activity_at
end
end
if
user
.
nil?
if
user
.
nil?
...
...
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