Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

remove unused/outdated reset functionality

ulferts1f2b0b1dd7ab
diff --git a/lib/plugins/acts_as_journalized/lib/acts_as_journalized.rb b/lib/plugins/acts_as_journalized/lib/acts_as_journalized.rb
index d15f4cc5525..3fad6c13f02 100644
--- a/lib/plugins/acts_as_journalized/lib/acts_as_journalized.rb
+++ b/lib/plugins/acts_as_journalized/lib/acts_as_journalized.rb
@@ -57,7 +57,7 @@ module Redmine
module Journalized
def self.included(base)
base.extend ClassMethods
- base.extend Versioned
+ base.extend Journalized
end
module ClassMethods
@@ -77,7 +77,6 @@ module Redmine
include Options
include Creation
include Reversion
- include Reset
include Permissions
include SaveHooks
include FormatHooks
diff --git a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/versioned.rb b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/journalized.rb
similarity index 99%
rename from lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/versioned.rb
rename to lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/journalized.rb
index 037b341ac96..14ec65190eb 100644
--- a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/versioned.rb
+++ b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/journalized.rb
@@ -66,7 +66,7 @@
module Redmine::Acts::Journalized
# Simply adds a flag to determine whether a model class if journaled.
- module Versioned
+ module Journalized
def self.extended(base) # :nodoc:
base.class_eval do
class << self
diff --git a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/reset.rb b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/reset.rb
deleted file mode 100644
index 48543fcd8ea..00000000000
--- a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/reset.rb
+++ /dev/null
@@ -1,94 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2020 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2017 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See docs/COPYRIGHT.rdoc for more details.
-#++
-
-#-- encoding: UTF-8
-# This file included as part of the acts_as_journalized plugin for
-# the redMine project management software; You can redistribute it
-# and/or modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The original copyright and license conditions are:
-# Copyright (c) 2009 Steve Richert
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-module Redmine::Acts::Journalized
- # Adds the ability to "reset" (or hard revert) a journaled ActiveRecord::Base instance.
- module Reset
- def self.included(base) # :nodoc:
- base.class_eval do
- include InstanceMethods
- end
- end
-
- # Adds the instance methods required to reset an object to a previous journal.
- module InstanceMethods
- # Similar to +revert_to!+, the +reset_to!+ method reverts an object to a previous journal,
- # only instead of creating a new record in the journal history, +reset_to!+ deletes all of
- # the journal history that occurs after the journal reverted to.
- #
- # The action taken on each journal record after the point of rejournal is determined by the
- # <tt>:dependent</tt> option given to the +journaled+ method. See the +journaled+ method
- # documentation for more details.
- def reset_to!(value)
- if saved = skip_journal { revert_to!(value) }
- journals.send(:delete_records, journals.after(value))
- reset_journal
- end
- saved
- end
- end
- end
-end
diff --git a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/reversion.rb b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/reversion.rb
index 074bb91a2f9..42135f509a7 100644
--- a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/reversion.rb
+++ b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/reversion.rb
@@ -92,38 +92,6 @@ module Redmine::Acts::Journalized
end
end
- # Accepts a value corresponding to a specific journal record, builds a history of changes
- # between that journal and the current journal, and then iterates over that history updating
- # the object's attributes until the it's reverted to its prior state.
- #
- # The single argument should adhere to one of the formats as documented in the +at+ method of
- # VestalVersions::Versions.
- #
- # After the object is reverted to the target journal, it is not saved. In order to save the
- # object after the rejournal, use the +revert_to!+ method.
- #
- # The journal number of the object will reflect whatever journal has been reverted to, and
- # the return value of the +revert_to+ method is also the target journal number.
- def revert_to(value)
- to_number = journals.journal_at(value)
-
- changes_between(journal, to_number).each do |attribute, change|
- write_attribute(attribute, change.last)
- end
- end
-
- # Behaves similarly to the +revert_to+ method except that it automatically saves the record
- # after the rejournal. The return value is the success of the save.
- def revert_to!(value)
- revert_to(value)
- end
-
- # Returns a boolean specifying whether the object has been reverted to a previous journal or
- # if the object represents the latest journal in the journal history.
- def reverted?
- version != last_version
- end
-
private
# Returns the number of the last created journal in the object's journal history.