Skip to content

Commit c69ff39

Browse files
author
danielshicn
committedJul 16, 2022
Basic Redmine 5.0 Compability
1 parent 9c8330d commit c69ff39

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed
 

‎init.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929

3030

3131
if Rails::VERSION::MAJOR >= 3
32-
Rails.configuration.to_prepare do
33-
require_dependency 'clipboard_image_paste/hooks'
32+
dispatcher = Rails.version < '5.1' ? ActionDispatch::Callbacks : ActiveSupport::Reloader
33+
dispatcher.to_prepare do
34+
# require_dependency 'clipboard_image_paste/hooks'
3435
require_dependency 'clipboard_image_paste/attachment_patch'
3536
end
3637
else

‎lib/clipboard_image_paste/attachment_patch.rb

+17-17
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# - GNU GENERAL PUBLIC LICENSE Version 2
1313
#*******************************************************************************
1414

15-
module AttachmentPatch
15+
module ClipboardImagePaste::AttachmentPatch
1616
# go through attachments and find keys starting by 100;
1717
# image attachments are identified by key >= 10001, the keys should be numbers
1818
# 'cause acts_as_attachable is sorting them according to insertion order
@@ -84,38 +84,38 @@ def remove_alpha(imgData)
8484
# Send patches - guarded against including the module multiple time
8585
# (like in tests) and registering multiple callbacks
8686

87-
unless Issue.included_modules.include? AttachmentPatch
88-
Issue.send(:prepend, AttachmentPatch)
87+
unless Issue.included_modules.include? ClipboardImagePaste::AttachmentPatch
88+
Issue.send(:prepend, ClipboardImagePaste::AttachmentPatch)
8989
end
9090

91-
unless News.included_modules.include? AttachmentPatch
92-
News.send(:prepend, AttachmentPatch)
91+
unless News.included_modules.include? ClipboardImagePaste::AttachmentPatch
92+
News.send(:prepend, ClipboardImagePaste::AttachmentPatch)
9393
end
9494

95-
unless WikiPage.included_modules.include? AttachmentPatch
96-
WikiPage.send(:prepend, AttachmentPatch)
95+
unless WikiPage.included_modules.include? ClipboardImagePaste::AttachmentPatch
96+
WikiPage.send(:prepend, ClipboardImagePaste::AttachmentPatch)
9797
end
9898

99-
unless Message.included_modules.include? AttachmentPatch
100-
Message.send(:prepend, AttachmentPatch)
99+
unless Message.included_modules.include? ClipboardImagePaste::AttachmentPatch
100+
Message.send(:prepend, ClipboardImagePaste::AttachmentPatch)
101101
end
102102

103-
unless Document.included_modules.include? AttachmentPatch
104-
Document.send(:prepend, AttachmentPatch)
103+
unless Document.included_modules.include? ClipboardImagePaste::AttachmentPatch
104+
Document.send(:prepend, ClipboardImagePaste::AttachmentPatch)
105105
end
106106

107-
unless Version.included_modules.include? AttachmentPatch
108-
Version.send(:prepend, AttachmentPatch)
107+
unless Version.included_modules.include? ClipboardImagePaste::AttachmentPatch
108+
Version.send(:prepend, ClipboardImagePaste::AttachmentPatch)
109109
end
110110

111-
unless Project.included_modules.include? AttachmentPatch
112-
Project.send(:prepend, AttachmentPatch)
111+
unless Project.included_modules.include? ClipboardImagePaste::AttachmentPatch
112+
Project.send(:prepend, ClipboardImagePaste::AttachmentPatch)
113113
end
114114

115115
# KbArticle plug-in (https://github.com/alexbevi/redmine_knowledgebase)
116116
begin
117-
unless KbArticle.included_modules.include? AttachmentPatch
118-
KbArticle.send(:prepend, AttachmentPatch)
117+
unless KbArticle.included_modules.include? ClipboardImagePaste::AttachmentPatch
118+
KbArticle.send(:prepend, ClipboardImagePaste::AttachmentPatch)
119119
end
120120
rescue NameError => e
121121
# plug-in not installed

0 commit comments

Comments
 (0)
Please sign in to comment.