Commit 117baf005cd3308336f468680f33f57774ebd061
1 parent
11173e81
Exists in
master
and in
1 other branch
Turn on/off email notifications for deploys and errors on a per-application basi…
…s. Allow message with deploy notifications (so we know what is was for)
Showing
8 changed files
with
23 additions
and
4 deletions
Show diff stats
app/controllers/deploys_controller.rb
1 | 1 | class DeploysController < ApplicationController |
2 | + | |
3 | + protect_from_forgery :except => :create | |
2 | 4 | |
3 | 5 | skip_before_filter :verify_authenticity_token, :only => :create |
4 | 6 | skip_before_filter :authenticate_user!, :only => :create |
... | ... | @@ -9,7 +11,8 @@ class DeploysController < ApplicationController |
9 | 11 | :username => params[:deploy][:local_username], |
10 | 12 | :environment => params[:deploy][:rails_env], |
11 | 13 | :repository => params[:deploy][:scm_repository], |
12 | - :revision => params[:deploy][:scm_revision] | |
14 | + :revision => params[:deploy][:scm_revision], | |
15 | + :message => params[:deploy][:message] | |
13 | 16 | }) |
14 | 17 | render :xml => @deploy |
15 | 18 | end | ... | ... |
app/models/app.rb
... | ... | @@ -5,6 +5,8 @@ class App |
5 | 5 | field :name, :type => String |
6 | 6 | field :api_key |
7 | 7 | field :resolve_errs_on_deploy, :type => Boolean, :default => false |
8 | + field :notify_on_errs, :type => Boolean, :default => false | |
9 | + field :notify_on_deploys, :type => Boolean, :default => false | |
8 | 10 | key :name |
9 | 11 | |
10 | 12 | embeds_many :watchers | ... | ... |
app/models/deploy.rb
... | ... | @@ -6,6 +6,7 @@ class Deploy |
6 | 6 | field :repository |
7 | 7 | field :environment |
8 | 8 | field :revision |
9 | + field :message | |
9 | 10 | |
10 | 11 | index :created_at, Mongo::DESCENDING |
11 | 12 | |
... | ... | @@ -27,7 +28,7 @@ class Deploy |
27 | 28 | protected |
28 | 29 | |
29 | 30 | def should_notify? |
30 | - app.watchers.any? | |
31 | + app.notify_on_deploys? && app.watchers.any? | |
31 | 32 | end |
32 | 33 | |
33 | 34 | def should_resolve_app_errs? | ... | ... |
app/models/err.rb
app/models/notice.rb
... | ... | @@ -73,7 +73,7 @@ class Notice |
73 | 73 | protected |
74 | 74 | |
75 | 75 | def should_notify? |
76 | - Errbit::Config.email_at_notices.include?(err.notices.count) && err.app.watchers.any? | |
76 | + err.app.notify_on_errs? && Errbit::Config.email_at_notices.include?(err.notices.count) && err.app.watchers.any? | |
77 | 77 | end |
78 | 78 | |
79 | 79 | end |
80 | 80 | \ No newline at end of file | ... | ... |
app/views/apps/_fields.html.haml
... | ... | @@ -5,9 +5,17 @@ |
5 | 5 | = f.text_field :name |
6 | 6 | |
7 | 7 | %div.checkbox |
8 | + = f.check_box :notify_on_errs | |
9 | + = f.label :notify_on_errs, 'Notify on errors' | |
10 | + | |
11 | +%div.checkbox | |
8 | 12 | = f.check_box :resolve_errs_on_deploy |
9 | 13 | = f.label :resolve_errs_on_deploy, 'Resolve errs on deploy' |
10 | - | |
14 | + | |
15 | +%div.checkbox | |
16 | + = f.check_box :notify_on_deploys | |
17 | + = f.label :notify_on_deploys, 'Notify on deploys' | |
18 | + | |
11 | 19 | %fieldset.nested-wrapper |
12 | 20 | %legend Watchers |
13 | 21 | - f.fields_for :watchers do |w| | ... | ... |
app/views/apps/show.html.haml
... | ... | @@ -32,6 +32,7 @@ |
32 | 32 | %tr |
33 | 33 | %th When |
34 | 34 | %th Who |
35 | + %th Message | |
35 | 36 | %th Repository |
36 | 37 | %th Revision |
37 | 38 | |
... | ... | @@ -40,6 +41,7 @@ |
40 | 41 | %tr |
41 | 42 | %td.when #{deploy.created_at.to_s(:micro)} |
42 | 43 | %td.who #{deploy.username} |
44 | + %td.message #{deploy.message} | |
43 | 45 | %td.repository #{deploy.repository} |
44 | 46 | %td.revision #{deploy.revision} |
45 | 47 | = link_to "All Deploys (#{@app.deploys.count})", app_deploys_path(@app), :class => 'button' | ... | ... |
app/views/deploys/_table.html.haml
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | %th App |
5 | 5 | %th When |
6 | 6 | %th Who |
7 | + %th Message | |
7 | 8 | %th Repository |
8 | 9 | %th Revision |
9 | 10 | %tbody |
... | ... | @@ -14,5 +15,6 @@ |
14 | 15 | %span.environment= deploy.environment |
15 | 16 | %td.latest #{time_ago_in_words(deploy.created_at)} ago |
16 | 17 | %td.who #{deploy.username} |
18 | + %td.message #{deploy.message} | |
17 | 19 | %td.repository #{deploy.repository} |
18 | 20 | %td.revision #{deploy.revision} | ... | ... |