Skip to content
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

Added the ability to filter messages about a task change by field #48

Open
wants to merge 5 commits into
base: main
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
1 change: 1 addition & 0 deletions app/controllers/messenger_settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def allowed_params
:post_wiki_updates,
:post_db,
:post_db_updates,
:post_actions,
:post_private_db,
:post_contact,
:post_contact_updates,
Expand Down
3 changes: 3 additions & 0 deletions app/views/settings/_messenger_settings.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ fieldset#messenger_settings.box.tabular
p
= content_tag(:label, l(:label_settings_post_updates))
= check_box_tag 'settings[post_updates]', 1, @settings[:post_updates].to_i == 1
p
= content_tag(:label, l(:label_settings_post_actions))
= select_tag 'settings[post_actions]', options_for_select(["any", [l(:field_project), "project"], [l(:field_tracker), "tracker"], [l(:field_parent), "parent"], [l(:field_status), "status"], [l(:field_priority), "priority"], [l(:field_subject), "subject"], [l(:field_author), "author"], [l(:field_assigned_to), "assigned_to"], [l(:field_updated_on), "updated_on"], [l(:field_category), "category"], [l(:field_fixed_version), "fixed_version"], [l(:field_start_date), "start_date"], [l(:field_due_date), "due_date"], [l(:field_estimated_hours), "estimated_hours"], [l(:field_done_ratio), "done_ratio"]], @settings[:post_actions]), :multiple => true
p
= content_tag(:label, l(:label_settings_new_include_description))
= check_box_tag 'settings[new_include_description]', 1, @settings[:new_include_description].to_i == 1
Expand Down
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ de:
label_settings_post_updates: Ticket Updates?
label_settings_post_wiki_updates: Wiki Updates?
label_settings_post_wiki: Neue Wikis?
label_settings_post_actions: Bei der Aktualisierung welche Felder?
label_settings_updated_include_description: Ticket Beschreibungsupdates?
messenger_channel_info_html: 'Hier wird der Channel dem die Nachrichten gesendet werden sollen. Es können mehrere Channel angegeben werden, indem Sie mit Komma getrennt werden.'
messenger_contacts_intro: Legen Sie fest welche Einträge oder Änderungen für Kontakte im angegebenen Messenger Channel versendet werden.
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ en:
label_settings_post_updates: Issue updates?
label_settings_post_wiki_updates: Wiki updates?
label_settings_post_wiki: Post Wiki added?
label_settings_post_actions: When updating which fields?
label_settings_updated_include_description: Description in update issue?
messenger_channel_info_html: 'Here you have to specify the channel, which should be used. You can define multible channels, seperated by comma'
messenger_contacts_intro: Activate the changes for Issues that should be sent to the pre-defined Messenger channel.
Expand Down
1 change: 1 addition & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ fr:
label_settings_post_updates: Inclure toutes les mises à jour
label_settings_post_wiki_updates: Inclure les mises à jour du wiki
label_settings_post_wiki: Inclure les publications du wiki
label_settings_post_actions: Lors de la mise à jour de quels champs?
label_settings_updated_include_description: Inclure la description suite à une mise à jour
messenger_channel_info_html: 'Spécifier le canal à utiliser. Vous pouvez définir plusieurs canaux, séparés par une virgule.'
messenger_contacts_intro: Activer les modifications pour les contacts à envoyer au canal Messenger prédéfini.
Expand Down
1 change: 1 addition & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ ja:
label_settings_post_updates: チケットの更新
label_settings_post_wiki_updates: Wikiの更新
label_settings_post_wiki: Wikiの作成
label_settings_post_actions: どのフィールドを更新するのですか?
label_settings_updated_include_description: チケット更新時に説明を含める
messenger_channel_info_html: チャンネルを指定する必要があります。複数のチャンネルを指定する場合は,(カンマ)で区切って下さい。
messenger_contacts_intro: メッセンジャーに送信するチケットのイベントにチェックを入れて下さい。
Expand Down
1 change: 1 addition & 0 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
post_private_db: '0',
post_private_issues: '0',
post_private_notes: '0',
post_actions: 'any',
post_wiki: '0',
post_wiki_updates: '0',
post_db: '0',
Expand Down
16 changes: 16 additions & 0 deletions lib/redmine_messenger/patches/issue_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ def send_messenger_create
def send_messenger_update
return if current_journal.nil?

should_be_sent = false
if !RedmineMessenger.settings[:post_actions].empty?
issue_update_active_actions = RedmineMessenger.settings[:post_actions]

should_be_sent = true if issue_update_active_actions.include?('any')

current_journal.details.each do |detail|
prop_string = detail.prop_key.to_s.sub('_id', '')
should_be_sent = true if issue_update_active_actions.include?(prop_string)
end
else
should_be_sent = true
end

return unless should_be_sent

channels = Messenger.channels_for_project project
url = Messenger.url_for_project project

Expand Down