Commit 085ef2650ea5e291dd6f704b377e631922d78f98
1 parent
33ae78df
Exists in
master
and in
1 other branch
Send notices to either all users plus watchers, or to the configured watchers
Showing
3 changed files
with
8 additions
and
4 deletions
Show diff stats
app/models/app.rb
... | ... | @@ -124,7 +124,11 @@ class App |
124 | 124 | end |
125 | 125 | |
126 | 126 | def notification_recipients |
127 | - notify_all_users ? User.all.map(&:email).reject(&:blank?) : watchers.map(&:address) | |
127 | + if notify_all_users | |
128 | + (User.all.map(&:email).reject(&:blank?) + watchers.map(&:address)).uniq | |
129 | + else | |
130 | + watchers.map(&:address) | |
131 | + end | |
128 | 132 | end |
129 | 133 | |
130 | 134 | # Copy app attributes from another app. | ... | ... |
app/views/apps/_fields.html.haml
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | = f.label :notify_on_deploys, 'Notify on deploys' |
24 | 24 | |
25 | 25 | %div.checkbox |
26 | - = f.check_box :notify_all_users, 'data-hide-when-checked' => '.watchers.nested-wrapper' | |
26 | + = f.check_box :notify_all_users | |
27 | 27 | = f.label :notify_all_users, 'Send notifications to all users' |
28 | 28 | |
29 | 29 | ... | ... |
spec/models/app_spec.rb
... | ... | @@ -88,12 +88,12 @@ describe App do |
88 | 88 | end |
89 | 89 | |
90 | 90 | context "notification recipients" do |
91 | - it "should send notices to either all users, or the configured watchers" do | |
91 | + it "should send notices to either all users plus watchers, or the configured watchers" do | |
92 | 92 | @app = Fabricate(:app) |
93 | 93 | 3.times { Fabricate(:user) } |
94 | 94 | 5.times { Fabricate(:watcher, :app => @app) } |
95 | 95 | @app.notify_all_users = true |
96 | - @app.notification_recipients.size.should == 3 | |
96 | + @app.notification_recipients.size.should == 8 | |
97 | 97 | @app.notify_all_users = false |
98 | 98 | @app.notification_recipients.size.should == 5 |
99 | 99 | end | ... | ... |