FIX: Watching First Post in groups was working incorrectly

This commit is contained in:
Robin Ward 2016-07-21 15:05:10 -04:00
parent c11f7bee99
commit c279889191
2 changed files with 2 additions and 1 deletions

View File

@ -120,7 +120,7 @@ class PostAlerter
.where(notification_level: TagUser.notification_levels[:watching_first_post])
.pluck(:user_id)
group_ids = post.user.groups.pluck(:id)
group_ids = topic.allowed_groups.pluck(:group_id)
group_watchers = GroupUser.where(group_id: group_ids,
notification_level: GroupUser.notification_levels[:watching_first_post])
.pluck(:user_id)

View File

@ -363,6 +363,7 @@ describe PostAlerter do
it "notifies the user who is following the first post group" do
GroupUser.create(group_id: group.id, user_id: user.id)
GroupUser.create(group_id: group.id, user_id: post.user.id)
topic.topic_allowed_groups.create(group_id: group.id)
level = GroupUser.notification_levels[:watching_first_post]
GroupUser.where(user_id: user.id, group_id: group.id).update_all(notification_level: level)