File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ class Comment < ApplicationRecord
1919
2020 validate :content_length
2121
22+ # Gets last activity date and time on the comment
23+ # @return [DateTime] last activity date and time
24+ def last_activity_at
25+ [ created_at , updated_at ] . compact . max
26+ end
27+
2228 def root
2329 # If parent_question is nil, the comment is already on a question, so we can just return post.
2430 parent_question || post
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ def can_access?(user)
5252 # Gets last activity date and time on the thread
5353 # @return [DateTime] last activity date and time
5454 def last_activity_at
55- [ created_at , locked_at , updated_at ] . compact . max
55+ last_comment_activity_at = comments . map ( &:last_activity_at ) . max
56+ [ created_at , locked_at , updated_at , last_comment_activity_at ] . compact . max
5657 end
5758
5859 # Gets a list of user IDs who should be pingable in the thread.
You can’t perform that action at this time.
0 commit comments