Error while loading /settings #1364
This commit is contained in:
parent
e5c6080bfd
commit
5dce7c284c
@ -39,10 +39,7 @@ require File.dirname(__FILE__) + '/redmine_dmsf/patches/issue_patch'
|
||||
require File.dirname(__FILE__) + '/redmine_dmsf/patches/role_patch'
|
||||
require File.dirname(__FILE__) + '/redmine_dmsf/patches/queries_controller_patch'
|
||||
|
||||
# redmine_resources depends on redmine_contact and redmine_contacts is alphabetically sorted before redmine_dmsf
|
||||
# in the plugin list.
|
||||
if (Redmine::Plugin.installed?(:redmine_contacts) || Redmine::Plugin.installed?(:redmine_questions)) &&
|
||||
!Redmine::Plugin.installed?(:easy_extensions)
|
||||
if RedmineDmsf::Plugin.present?(:redmine_questions) && !Redmine::Plugin.installed?(:easy_extensions)
|
||||
require File.dirname(__FILE__) + '/redmine_dmsf/patches/notifiable_ru_patch'
|
||||
else
|
||||
require File.dirname(__FILE__) + '/redmine_dmsf/patches/notifiable_patch'
|
||||
|
||||
@ -55,6 +55,6 @@ end
|
||||
if Redmine::Plugin.installed?(:easy_extensions)
|
||||
RedmineExtensions::PatchManager.register_patch_to_be_first 'Redmine::Notifiable',
|
||||
'RedmineDmsf::Patches::NotifiablePatch', prepend: true, first: true
|
||||
elsif !(Redmine::Plugin.installed?(:redmine_contacts) || Redmine::Plugin.installed?(:redmine_questions))
|
||||
else
|
||||
Redmine::Notifiable.prepend RedmineDmsf::Patches::NotifiablePatch
|
||||
end
|
||||
@ -54,7 +54,4 @@ module RedmineDmsf
|
||||
end
|
||||
|
||||
# Apply the patch
|
||||
if (Redmine::Plugin.installed?(:redmine_contacts) || Redmine::Plugin.installed?(:redmine_questions)) &&
|
||||
!Redmine::Plugin.installed?(:easy_extensions)
|
||||
Redmine::Notifiable.send :include, RedmineDmsf::Patches::NotifiableRuPatch
|
||||
end
|
||||
Redmine::Notifiable.send :include, RedmineDmsf::Patches::NotifiableRuPatch
|
||||
33
lib/redmine_dmsf/plugin.rb
Normal file
33
lib/redmine_dmsf/plugin.rb
Normal file
@ -0,0 +1,33 @@
|
||||
# encoding: utf-8
|
||||
# frozen_string_literal: true
|
||||
#
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright © 2011-22 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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.
|
||||
|
||||
module RedmineDmsf
|
||||
module Plugin
|
||||
|
||||
# Checking physical presence of the plugin as Redmine::Plugin.installed? may return false due to alphabetical
|
||||
# registering of available plugins.
|
||||
def self.present?(id)
|
||||
Dir.exist? File.join(Rails.root, 'plugins', id.to_s)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
34
test/unit/lib/redmine_dmsf/dmsf_plugin_test.rb
Normal file
34
test/unit/lib/redmine_dmsf/dmsf_plugin_test.rb
Normal file
@ -0,0 +1,34 @@
|
||||
# encoding: utf-8
|
||||
# frozen_string_literal: true
|
||||
#
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2011-22 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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.
|
||||
|
||||
require File.expand_path('../../../../test_helper', __FILE__)
|
||||
|
||||
class DmsfPluginTest < RedmineDmsf::Test::HelperTest
|
||||
|
||||
def test_present_yes
|
||||
assert RedmineDmsf::Plugin.present?(:redmine_dmsf)
|
||||
end
|
||||
|
||||
def test_present_no
|
||||
assert !RedmineDmsf::Plugin.present?(:redmine_dmsfx)
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user