FIX: set notification level when changing post owner (#5616)

FIX: do not notify last post editor if they mention themself
This commit is contained in:
Maja Komel
2018-04-16 11:48:06 +02:00
committed by Gerhard Schlager
parent b602bab741
commit 3d99726981
4 changed files with 30 additions and 1 deletions

View File

@@ -47,7 +47,7 @@ class PostAlerter
end
def after_save_post(post, new_record = false)
notified = [post.user]
notified = [post.user, post.last_editor].uniq
# mentions (users/groups)
mentioned_groups, mentioned_users = extract_mentions(post)

View File

@@ -23,6 +23,12 @@ class PostOwnerChanger
post.set_owner(@new_owner, @acting_user, @skip_revision)
PostAction.remove_act(@new_owner, post, PostActionType.types[:like])
if post.post_number == 1
TopicUser.change(@new_owner.id, @topic.id, notification_level: NotificationLevels.topic_levels[:watching])
else
TopicUser.change(@new_owner.id, @topic.id, notification_level: NotificationLevels.topic_levels[:tracking])
end
@topic.update_statistics
@new_owner.user_stat.update(