如何解决Redmine - 停止通知 - 阴暗模式不起作用
我在服务器上安装了 redmine,我已经安装了 3.4 版本的 shady mode 插件并且它可以工作,但现在我已经更新到 4.1 并且无法工作。这个插件允许我启用阴暗模式并停止发送通知。
我发现了插件代码的问题,我发现了两个文件,其中两个文件都通过检索用户的属性来检查模式是否处于活动状态,在一个文件中,检查实际上有效并且条件返回正确值,在另一个文件(决定是否实际发送电子邮件的文件)中,此设置始终为 false(或 null)。
这是有效的文件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
中无效?
解决方法
在 Redmine 3.4 和 Redmine 4.1 之间,电子邮件通知的发送方式有 changed significantly。
具体来说,Redmine 现在在后台呈现和发送通知邮件,而不是在更新请求中等待。此外,现在为每个收件人呈现唯一的邮件。在呈现邮件时,User.current
将设置为相应的收件人(而不是 Redmine 3.4 中的发送用户)。
因此,该插件需要针对 Redmine 4.1 进行更新,并且可能由于 Redmine 的这些更改而需要进行重大的重新架构。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。