Merge pull request #1570 from uhuntu/master-self

Emails are not sent to the author if no_self_notified
This commit is contained in:
Karel Pičman 2024-12-06 08:19:18 +01:00 committed by GitHub
commit f2c8c4d1c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -158,9 +158,19 @@ class DmsfMailer < Mailer
@notice = notice @notice = notice
@author = revision.dmsf_workflow_assigned_by_user @author = revision.dmsf_workflow_assigned_by_user
@author ||= User.anonymous @author ||= User.anonymous
mail to: user, skip_no_self_notified = false
subject: begin
"[#{@project.name} - #{l(:field_label_dmsf_workflow)}] #{@workflow.name} #{l(subject_id)} #{step_name}" # We need to switch off no_self_notified temporarily otherwise the email won't be sent
if (@author == user) && @author.pref.no_self_notified
@author.pref.no_self_notified = false
skip_no_self_notified = true
end
mail to: user,
subject:
"[#{@project.name} - #{l(:field_label_dmsf_workflow)}] #{@workflow.name} #{l(subject_id)} #{step_name}"
ensure
@author.pref.no_self_notified = true if skip_no_self_notified
end
end end
# force_notification = true => approval workflow's notifications # force_notification = true => approval workflow's notifications