首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Redmine -停止通知- Shady模式不工作

Redmine -停止通知- Shady模式不工作
EN

Stack Overflow用户
提问于 2021-03-23 21:00:55
回答 1查看 34关注 0票数 0

我有一个redmine的服务器安装,我已经安装了3.4版本的阴影模式插件,它正在工作,但现在我已经更新到4.1,不工作。这个插件允许我启用阴影模式并停止发送通知。

我发现了插件代码的问题,我发现了两个文件,在这两个文件中,它都通过检索用户的属性来检查模式是否处于活动状态,在一个文件中,检查实际有效,条件返回正确的值,在另一个文件(决定是否实际发送电子邮件的文件)中,此设置始终为false (或null)。

我猜在新版本的redmine中,这段代码中的插件无法找到变量。

这是工作于hook.rb的文件

代码语言:javascript
复制
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

代码语言:javascript
复制
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中运行

EN

回答 1

Stack Overflow用户

发布于 2021-03-24 05:18:27

在Redmine 3.4和Redmine 4.1之间,电子邮件通知的发送方式有changed significantly

具体来说,Redmine现在在后台呈现和发送通知邮件,而不是等待更新请求。此外,现在为每个收件人呈现唯一的邮件。在呈现邮件时,User.current将被设置为相应的收件人(而不是Redmin3.4中的发送用户)。

因此,该插件需要针对Redmine 4.1进行更新,并且由于Redmine的这些更改,可能需要进行重大的重新架构。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66763668

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档