peclik / clipboard_image_paste

Redmine plugin for pasting cropped image from clipboard as an attachment.
264 stars 118 forks source link

No compatibility with Rails >5.0 #70

Open tB0nE opened 7 years ago

tB0nE commented 7 years ago

"ActionDispatch::Callbacks.to_prepare do" in init.rb is depreciated, I believe it can just be replaced with:

"ActiveSupport::Reloader.to_prepare do"

"alias_method_chain :save_attachments, :pasted_images" in attachment_patch.rb is depreciated (alias_method_chain), it needs to be replaced with Module#prepend but I don't know ruby so I don't really know how to do this.

SeparateReality commented 6 years ago

I am not familiar with ruby either. Came a bit futher but something is still missing:

  1. I replaced ActionDispatch::Callbacks.to_prepare do in init.rb with ActiveSupport::Reloader.to_prepare do I guess that's the easy part.

  2. Using Module#prepend instead of alias_method_chain probably needs some more rework. Looking at this post https://littlelines.com/blog/2018/01/31/replace-alias-method-chain I tried the following in attachement_path.rb (to replace alias_method_chain)

    alias_method :save_attachments_without_pasted_images, :save_attachments
    alias_method :save_attachments, :save_attachments_with_pasted_images

    Now the errors are gone but when pasting an image it is not saved....

Would be great if someone could resolve this issue. Otherwise this fantastic plugin wont work with Redmine >= 3.4.5

kzalewski commented 5 years ago

The pull request from Utopism (PR #80) resolves this issue. I urge the author of clipboard_image_paste to please approve and merge this pull request as soon as possible.