我有一个redmine的服务器安装,我已经安装了3.4版本的阴影模式插件,它正在工作,但现在我已经更新到4.1,不工作。这个插件允许我启用阴影模式并停止发送通知。
我发现了插件代码的问题,我发现了两个文件,在这两个文件中,它都通过检索用户的属性来检查模式是否处于活动状态,在一个文件中,检查实际有效,条件返回正确的值,在另一个文件(决定是否实际发送电子邮件的文件)中,此设置始终为false (或null)。
我猜在新版本的redmine中,这段代码中的插件无法找到变量。
这是工作于hook.rb的文件
module RedmineShady
module Hook
class ViewListener < Redmine::Hook::ViewListener
# necessary for using content_tag in Listener
attr_accessor :output_buffer
# If shady, show message on the top
def view_layouts_base_html_head(context = {})
session = context[:controller].session
if User.current.pref[:shady]
style = 'margin: 0; padding: 10px; border-width: 0 0 2px; background-image: none'
content_tag :div, id: 'shady-bar', class: 'flash error', style: style do
concat link_to l(:button_cancel), { controller: 'shady', action: 'destroy' },
method: :delete, style: 'float: right'
concat l(:notice_shady_mode)
end
end
end
end
end
end这是不起作用的文件:mail_interceptor.rb
module RedmineShady
class MailInterceptor
def self.delivering_email(message)
message.perform_deliveries = false if User.current.pref[:shady]
end
end
end为什么User.current.pref[:shady]可以在hook.rb中运行,但不能在mail_interceptor.rb中运行
发布于 2021-03-24 05:18:27
在Redmine 3.4和Redmine 4.1之间,电子邮件通知的发送方式有changed significantly。
具体来说,Redmine现在在后台呈现和发送通知邮件,而不是等待更新请求。此外,现在为每个收件人呈现唯一的邮件。在呈现邮件时,User.current将被设置为相应的收件人(而不是Redmin3.4中的发送用户)。
因此,该插件需要针对Redmine 4.1进行更新,并且由于Redmine的这些更改,可能需要进行重大的重新架构。
https://stackoverflow.com/questions/66763668
复制相似问题