diff --git a/app/views/settings/_redmine_hipchat.html.erb b/app/views/settings/_redmine_hipchat.html.erb index 836b1ea..783b2aa 100644 --- a/app/views/settings/_redmine_hipchat.html.erb +++ b/app/views/settings/_redmine_hipchat.html.erb @@ -16,6 +16,17 @@ Notify room members? Will trigger sound/popup based on user preferences.

+

+ <%= content_tag(:label, l(:hipchat_settings_label_notify_on_update)) %> + <%= check_box_tag 'settings[notify_on_update]', 1, @settings[:notify_on_update] %> + Notify on issue update ? Will send notification on every issue update. +

+ +

+ <%= content_tag(:label, l(:hipchat_settings_label_trackers)) %> + <%= select_tag 'settings[trackers][]', options_for_select(Tracker.all.collect {|tracker| [ tracker.name, tracker.id ]}, :selected => @settings[:trackers]), :multiple => true, :size => Tracker.all.size %> +

+

<%= content_tag(:label, l(:hipchat_settings_label_projects)) %> <%= select_tag 'settings[projects][]', project_tree_options_for_select(Project.active, :selected => Project.where(:id => @settings[:projects])), :multiple => true, :size => Project.active.size %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 0cf5c3a..4c2c02f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,6 +3,8 @@ en: hipchat_settings_label_room_id: Room ID hipchat_settings_label_auth_token: Room token hipchat_settings_label_notify: Notify + hipchat_settings_label_notify_on_update: Update + hipchat_settings_label_trackers: Trackers hipchat_settings_label_projects: Projects field_hipchat_auth_token: HipChat Room token field_hipchat_room_name: HipChat Room ID diff --git a/lib/hipchat_hooks.rb b/lib/hipchat_hooks.rb index 73d52a7..8be97bc 100644 --- a/lib/hipchat_hooks.rb +++ b/lib/hipchat_hooks.rb @@ -6,6 +6,7 @@ def controller_issues_new_after_save(context = {}) issue = context[:issue] project = issue.project return true if !hipchat_configured?(project) + return true if !Setting.plugin_redmine_hipchat[:trackers].include?(issue.tracker.id.to_s) author = CGI::escapeHTML(User.current.name) tracker = CGI::escapeHTML(issue.tracker.name.downcase) @@ -23,6 +24,7 @@ def controller_issues_new_after_save(context = {}) end def controller_issues_edit_after_save(context = {}) + return true if !Setting.plugin_redmine_hipchat[:notify_on_update] issue = context[:issue] project = issue.project return true if !hipchat_configured?(project)