From 5b5c110a7787e5732870dfb1cbb7ecd090d22633 Mon Sep 17 00:00:00 2001 From: ulferts Date: Fri, 3 Apr 2020 10:02:03 +0200 Subject: [PATCH] remove unused method --- .../lib/redmine/acts/journalized/creation.rb | 9 --------- .../redmine/acts/journalized/permissions.rb | 18 ++++++++++++------ .../lib/redmine/acts/journalized/save_hooks.rb | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/creation.rb b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/creation.rb index 0611c82d37..25e1b7e0c6 100644 --- a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/creation.rb +++ b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/creation.rb @@ -190,15 +190,6 @@ module Redmine::Acts::Journalized def activity_type self.class.name.underscore.pluralize end - - # Specifies the attributes used during journal creation. This is separated into its own - # method so that it can be overridden by the VestalVersions::Users feature. - def journal_attributes - { journaled_id: id, activity_type: activity_type, - details: journal_changes, version: last_version + 1, - notes: journal_notes, user_id: (journal_user.try(:id) || User.current.try(:id)) - }.merge(extra_journal_attributes || {}) - end end end end diff --git a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/permissions.rb b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/permissions.rb index adcd0fbff6..0413184cc9 100644 --- a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/permissions.rb +++ b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/permissions.rb @@ -52,17 +52,23 @@ module Redmine::Acts::Journalized # Is overridden if defined in the journalized model directly def journal_editable_by?(user) return true if user.admin? + if respond_to? :editable_by? editable_by? user else - permission = if respond_to? :journal_permission - journal_permission - else - :"edit_#{self.class.to_s.pluralize.underscore}" - end p = @project || (project if respond_to? :project) options = { global: p.present? } - user.allowed_to? permission, p, options + user.allowed_to? journable_edit_permission, p, options + end + end + + private + + def journable_edit_permission + if respond_to? :journal_permission + journal_permission + else + :"edit_#{self.class.to_s.pluralize.underscore}" end end end diff --git a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/save_hooks.rb b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/save_hooks.rb index dbb6f9b4f6..6802b946e2 100644 --- a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/save_hooks.rb +++ b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/save_hooks.rb @@ -59,7 +59,7 @@ module Redmine::Acts::Journalized after_update { save_journals } after_destroy :remove_journal_version - attr_accessor :journal_notes, :journal_user, :extra_journal_attributes + attr_accessor :journal_notes, :journal_user end end