Skip to content

Commit b6d0a52

Browse files
committed
even if there's nothing to do, bump thread's last activity to improve user experience
1 parent 76f5655 commit b6d0a52

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

app/models/comment_thread.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ def maximum_title_length
9292
# @param user [User] user to register as a follower
9393
# @return [Boolean] status of the operation
9494
def add_follower(user)
95-
return true if ThreadFollower.where(comment_thread: self, user: user).any?
95+
if ThreadFollower.where(comment_thread: self, user: user).any?
96+
bump_last_activity(persist_changes: true)
97+
return true
98+
end
9699

97100
ThreadFollower.create(comment_thread: self, user: user)
98101
end
@@ -111,7 +114,10 @@ def bump_last_activity(persist_changes: false)
111114
# @param user [User] user to remove from followers
112115
# @return [Boolean] status of the operation
113116
def remove_follower(user)
114-
return true if ThreadFollower.where(comment_thread: self, user: user).none?
117+
if ThreadFollower.where(comment_thread: self, user: user).none?
118+
bump_last_activity(persist_changes: true)
119+
return true
120+
end
115121

116122
ThreadFollower.where(comment_thread: self, user: user).destroy_all.any?
117123
end

0 commit comments

Comments
 (0)