From b7cc64c09929d1640ac61fe6c21adf69f3e7394e Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 28 Aug 2013 19:13:11 +0400 Subject: [PATCH] #283: Email notifications and ActivityFeed for publisher --- app/models/build_list.rb | 20 +++++++++---------- .../observers/activity_feed/build_list.rb | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 603e1bba8..07a2b57b0 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -448,17 +448,15 @@ class BuildList < ActiveRecord::Base def notify_users unless mass_build_id - users = [] - if project # find associated users - users = project.all_members. - select{ |user| user.notifier.can_notify? && user.notifier.new_associated_build? } - end - if user.notifier.can_notify? && user.notifier.new_build? - users = users | [user] - end - users.each do |user| - UserMailer.build_list_notification(self, user).deliver - end + users = [user] + users << publisher if publisher + users.select!{ |u| u.notifier.can_notify? && u.notifier.new_build? } + + # find associated users + users |= project.all_members.select do |u| + u.notifier.can_notify? && u.notifier.new_associated_build? + end if project + users.each{ |u| UserMailer.build_list_notification(self, u).deliver } end end # notify_users diff --git a/lib/modules/observers/activity_feed/build_list.rb b/lib/modules/observers/activity_feed/build_list.rb index e78719ca7..5a4d764cb 100644 --- a/lib/modules/observers/activity_feed/build_list.rb +++ b/lib/modules/observers/activity_feed/build_list.rb @@ -21,7 +21,7 @@ module Modules::Observers::ActivityFeed::BuildList ) updater = publisher || user - project.admins.each do |recipient| + (project.admins | [publisher].compact).each do |recipient| ActivityFeed.create( :user => recipient, :kind => 'build_list_notification',