Skip to content

Commit

Permalink
Merge pull request #11567 from adrianschroeter/notifications
Browse files Browse the repository at this point in the history
[api] avoid delivering notifications to unconfirmed users
  • Loading branch information
vpereira committed Sep 7, 2021
2 parents c5ad511 + ae61e81 commit f4dc113
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/api/app/models/event_subscription/find_for_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def filter_and_convert_groups_without_emails_to_users(receivers)
receivers.each do |receiver|
case receiver
when User
new_receivers << receiver
new_receivers << receiver if receiver.is_active?

when Group

Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/event_subscription/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def update!(subscriptions_params)
def find_or_initialize_subscription(eventtype, receiver_role, channel)
opts = { eventtype: eventtype, receiver_role: receiver_role, channel: channel }

if subscriber.is_a?(User)
if subscriber.is_a?(User) && subscriber.is_active?
opts[:user] = subscriber
elsif subscriber.is_a?(Group)
opts[:group] = subscriber
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def involved_packages

# returns the users that actually want email for this group's notifications
def email_users
User.where(id: groups_users.where(email: true).select(:user_id))
User.where(id: groups_users.where(email: true).select(:user_id), state: 'confirmed')
end

def display_name
Expand Down

0 comments on commit f4dc113

Please sign in to comment.