Expected false to be truthy
This commit is contained in:
parent
763871577c
commit
8842fd69ea
@ -166,23 +166,17 @@ class DmsfMailer < Mailer
|
|||||||
|
|
||||||
# force_notification = true => approval workflow's notifications
|
# force_notification = true => approval workflow's notifications
|
||||||
def self.get_notify_users(project, file, force_notification: false)
|
def self.get_notify_users(project, file, force_notification: false)
|
||||||
puts ">>> self.get_notify_users"
|
|
||||||
return [] unless project.active?
|
return [] unless project.active?
|
||||||
puts ">>> ok1"
|
|
||||||
# Notifications
|
# Notifications
|
||||||
if (force_notification && Setting.notified_events.include?('dmsf_workflow_plural')) ||
|
if (force_notification && Setting.notified_events.include?('dmsf_workflow_plural')) ||
|
||||||
(Setting.notified_events.include?('dmsf_legacy_notifications') && file&.notify?)
|
(Setting.notified_events.include?('dmsf_legacy_notifications') && file&.notify?)
|
||||||
puts ">>> ok2"
|
|
||||||
notify_members = project.members.active.select do |notify_member|
|
notify_members = project.members.active.select do |notify_member|
|
||||||
notify_user = notify_member.user
|
notify_user = notify_member.user
|
||||||
if notify_user == User.current && notify_user.pref.no_self_notified
|
if notify_user == User.current && notify_user.pref.no_self_notified
|
||||||
puts ">>> nok1"
|
|
||||||
false
|
false
|
||||||
elsif notify_member.dmsf_mail_notification.nil?
|
elsif notify_member.dmsf_mail_notification.nil?
|
||||||
puts ">>> notify_member.mail_notification: #{notify_member.dmsf_mail_notification}"
|
|
||||||
case notify_user.mail_notification
|
case notify_user.mail_notification
|
||||||
when 'all'
|
when 'all'
|
||||||
puts ">>> ok3"
|
|
||||||
true
|
true
|
||||||
when 'selected'
|
when 'selected'
|
||||||
notify_member.mail_notification?
|
notify_member.mail_notification?
|
||||||
@ -193,7 +187,6 @@ class DmsfMailer < Mailer
|
|||||||
when 'only_assigned'
|
when 'only_assigned'
|
||||||
file.assigned? notify_user
|
file.assigned? notify_user
|
||||||
else
|
else
|
||||||
puts ">>> nok2"
|
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@ -35,6 +35,10 @@ class DmsfMailerTest < RedmineDmsf::Test::UnitTest
|
|||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
Setting.plain_text_mail = '0'
|
Setting.plain_text_mail = '0'
|
||||||
Setting.default_language = 'en'
|
Setting.default_language = 'en'
|
||||||
|
# Notification
|
||||||
|
m1 = Member.find 1
|
||||||
|
m1.dmsf_mail_notification = true
|
||||||
|
m1.save
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_files_updated
|
def test_files_updated
|
||||||
@ -104,12 +108,7 @@ class DmsfMailerTest < RedmineDmsf::Test::UnitTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_get_notify_users
|
def test_get_notify_users
|
||||||
m1 = Member.find 1
|
|
||||||
m1.dmsf_mail_notification = true
|
|
||||||
m1.save
|
|
||||||
with_settings notified_events: ['dmsf_legacy_notifications'] do
|
with_settings notified_events: ['dmsf_legacy_notifications'] do
|
||||||
puts ">>> Setting.notified_events: #{Setting.notified_events}"
|
|
||||||
puts ">>> @file1.notify?: #{@file1.notify?}"
|
|
||||||
users = DmsfMailer.get_notify_users(@project1, @file1)
|
users = DmsfMailer.get_notify_users(@project1, @file1)
|
||||||
assert users.present?
|
assert users.present?
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user