From bb854c9c87b9c3530aa5b48f19e11f1c2bf1cb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Scha=CC=88fer?= Date: Sun, 20 Apr 2014 14:55:46 +0200 Subject: [PATCH] Fix for removed IssueObserver (Redmine 2.5) #5 --- init.rb | 1 - .../patches/issue_observer_patch.rb | 21 ------------------- .../patches/issue_patch.rb | 5 +++++ 3 files changed, 5 insertions(+), 22 deletions(-) delete mode 100644 lib/redmine_hoptoad_server/patches/issue_observer_patch.rb diff --git a/init.rb b/init.rb index 86b5756..246dcaf 100644 --- a/init.rb +++ b/init.rb @@ -13,6 +13,5 @@ Rails.configuration.to_prepare do require_dependency 'redmine_hoptoad_server/patches/issue_patch' - require_dependency 'redmine_hoptoad_server/patches/issue_observer_patch' end diff --git a/lib/redmine_hoptoad_server/patches/issue_observer_patch.rb b/lib/redmine_hoptoad_server/patches/issue_observer_patch.rb deleted file mode 100644 index 0eba826..0000000 --- a/lib/redmine_hoptoad_server/patches/issue_observer_patch.rb +++ /dev/null @@ -1,21 +0,0 @@ -require_dependency 'issue_observer' - -module RedmineHoptoadServer - module Patches - module IssueObserverPatch - def self.included(base) - base.class_eval do - include InstanceMethods - alias_method_chain :after_create, :notify_switch - end - end - module InstanceMethods - def after_create_with_notify_switch(issue) - after_create_without_notify_switch issue unless issue.skip_notification? - end - end - end - end -end - -IssueObserver.send(:include, RedmineHoptoadServer::Patches::IssueObserverPatch) unless IssueObserver.included_modules.include?(RedmineHoptoadServer::Patches::IssueObserverPatch) diff --git a/lib/redmine_hoptoad_server/patches/issue_patch.rb b/lib/redmine_hoptoad_server/patches/issue_patch.rb index 2205a8b..31eb1e9 100644 --- a/lib/redmine_hoptoad_server/patches/issue_patch.rb +++ b/lib/redmine_hoptoad_server/patches/issue_patch.rb @@ -9,6 +9,11 @@ def self.included(base) def skip_notification? @skip_notification == true end + + def send_notification_with_skip_notification + send_notification_without_skip_notification unless skip_notification? + end + alias_method_chain :send_notification, :skip_notification end end end