提交 ddd6f804 编写于 作者: W Wei-Meng Lee

Move method into group

上级 f7238306
......@@ -82,7 +82,7 @@ class Notify < BaseMailer
group_notification_email = nil
if notification_group
notification_settings = notification_group.notification_settings(hierarchy_order: :asc).where(user: @current_user) # rubocop: disable CodeReuse/ActiveRecord
notification_settings = notification_group.notification_settings_for(@current_user, hierarchy_order: :asc)
group_notification_email = notification_settings.find { |n| n.notification_email.present? }&.notification_email
end
......
......@@ -138,6 +138,10 @@ class Group < Namespace
.order("ordered_groups.depth #{hierarchy_order}")
end
def notification_settings_for(user, hierarchy_order: nil)
notification_settings(hierarchy_order: hierarchy_order).where(user: user)
end
def to_reference(_from = nil, full: nil)
"#{self.class.reference_prefix}#{full_path}"
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册