mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: Don't update the last poster when a whisper is made
This commit is contained in:
parent
e65ddc6c25
commit
9f89aefdd3
2 changed files with 5 additions and 1 deletions
|
@ -38,6 +38,7 @@ WITH cte as (
|
|||
JOIN posts p ON p.topic_id = t.id
|
||||
WHERE p.deleted_at IS NULL AND
|
||||
NOT p.hidden AND
|
||||
p.post_type <> #{Post.types[:whisper]} AND
|
||||
p.user_id <> t.user_id AND
|
||||
p.user_id <> t.last_post_user_id
|
||||
#{filter}
|
||||
|
@ -81,6 +82,7 @@ SQL
|
|||
private
|
||||
|
||||
def update_participant_count
|
||||
topic.update_columns(participant_count: topic.posts.count('distinct user_id'))
|
||||
count = topic.posts.where('NOT hidden AND post_type <> ?', Post.types[:whisper]).count('distinct user_id')
|
||||
topic.update_columns(participant_count: count)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -273,6 +273,8 @@ class PostCreator
|
|||
end
|
||||
|
||||
def update_topic_stats
|
||||
return if @post.post_type == Post.types[:whisper]
|
||||
|
||||
attrs = {
|
||||
last_posted_at: @post.created_at,
|
||||
last_post_user_id: @post.user_id,
|
||||
|
|
Loading…
Reference in a new issue