Skip to content

Added more setup options #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/views/settings/_redmine_hipchat.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@
Notify room members? Will trigger sound/popup based on user preferences.
</p>

<p>
<%= 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.
</p>

<p>
<%= 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 %>
</p>

<p>
<%= 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 %>
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/hipchat_hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down