From 6d1528f34863fc6cf41297344e3a1ee630a89c7c Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 21 May 2021 08:36:00 +0200 Subject: [PATCH] wip #4472 @1 --- Gemfile | 6 ----- Gemfile.save | 7 ++++++ lib/redmine_slack/patches/issue_patch.rb | 25 ++++++++++--------- .../patches/issues_controller_patch.rb | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 Gemfile.save diff --git a/Gemfile b/Gemfile index 1c52dc6..e7117a8 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,2 @@ gem 'slim-rails' gem 'validate_url' - -group :test do - gem 'rubocop', '~> 0.76.0', require: false - gem 'rubocop-performance', '~> 1.5.0', require: false - gem 'rubocop-rails', '~> 2.3.0', require: false -end diff --git a/Gemfile.save b/Gemfile.save new file mode 100644 index 0000000..11454a8 --- /dev/null +++ b/Gemfile.save @@ -0,0 +1,7 @@ +gem 'slim-rails' +gem 'validate_url' + +group :test do + gem 'rubocop', '~> 0.76.0', require: false + gem 'rubocop-performance', '~> 1.5.0', require: false + gem 'rubocop-rails', '~ diff --git a/lib/redmine_slack/patches/issue_patch.rb b/lib/redmine_slack/patches/issue_patch.rb index d31b7aa..86dcbda 100644 --- a/lib/redmine_slack/patches/issue_patch.rb +++ b/lib/redmine_slack/patches/issue_patch.rb @@ -9,8 +9,9 @@ module RedmineSlack def self.included(base) base.send(:include, InstanceMethods) base.class_eval do + unloadable after_create :send_redmine_slack_create - after_commit :send_redmine_slack_update, :on => :update + after_save :send_redmine_slack_update end end @@ -65,14 +66,14 @@ module RedmineSlack end def send_redmine_slack_update - return if current_journal.nil? - return if RequestStore.store[:redmine_slack_silent].nil? + #return if current_journal.nil? + # return if RequestStore.store[:redmine_slack_silent].nil? channels = Slack.channels_for_project project - return unless channels.present? && Slack.setting_for_project(project, :post_updates) - return if is_private? && !Slack.setting_for_project(project, :post_private_issues) - return if current_journal.private_notes? && !Slack.setting_for_project(project, :post_private_notes) + #return unless channels.present? && Slack.setting_for_project(project, :post_updates) + #return if is_private? && !Slack.setting_for_project(project, :post_private_issues) + #return if current_journal.private_notes? && !Slack.setting_for_project(project, :post_private_notes) set_language_if_valid Setting.default_language @@ -139,12 +140,12 @@ module RedmineSlack attachment[:fields] = fields if fields.any? - send_message = true - if Slack.setting_for_project(project, :supress_empty_messages) - send_message = false unless (attachment.any? && attachment.key?(:text)) || !text_diff.empty? - end - - return unless send_message + # send_message = true + # if Slack.setting_for_project(project, :supress_empty_messages) + # send_message = false unless (attachment.any? && attachment.key?(:text)) || !text_diff.empty? + # end + # + # return unless send_message attachment[:color] = Slack.textfield_for_project(project, :color_update_notifications) diff --git a/lib/redmine_slack/patches/issues_controller_patch.rb b/lib/redmine_slack/patches/issues_controller_patch.rb index 4af1939..cb1c6ad 100644 --- a/lib/redmine_slack/patches/issues_controller_patch.rb +++ b/lib/redmine_slack/patches/issues_controller_patch.rb @@ -9,7 +9,7 @@ module RedmineSlack def self.included(base) base.send(:include, InstanceMethods) base.class_eval do - before_action :handle_silent_update, :only => [:create, :update] + #before_action :handle_silent_update, :only => [:create, :update] end end -- 2.39.5