From c974d25ef62730f143f0a05af1706bb2f4b00fc3 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Wed, 9 Apr 2014 14:10:05 +0200 Subject: [PATCH] Don't display author's among email notification recipients when not_self_notify is set --- app/controllers/dmsf_workflows_controller.rb | 21 ++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb index 003926d7..b874ef29 100644 --- a/app/controllers/dmsf_workflows_controller.rb +++ b/app/controllers/dmsf_workflows_controller.rb @@ -1,6 +1,6 @@ # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2013 Karel Picman +# Copyright (C) 2011-14 Karel Picman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -58,17 +58,24 @@ class DmsfWorkflowsController < ApplicationController end if revision.workflow == DmsfWorkflow::STATE_APPROVED # Just approved - revision.file.project.members.each do |member| + recipients = revision.file.project.members.collect{ |m| m.user } + if User.current && User.current.logged? && User.current.pref.no_self_notified + recipients.delete User.current + end + recipients.each do |user| DmsfMailer.workflow_notification( - member.user, + user, @dmsf_workflow, revision, :text_email_subject_approved, :text_email_finished_approved, - :text_email_to_see_history).deliver if member.user + :text_email_to_see_history).deliver if user end if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1' recipients = revision.file.project.members.collect{ |m| m.user } + if User.current && User.current.logged? && User.current.pref.no_self_notified + recipients.delete User.current + end unless recipients.empty? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') @@ -80,6 +87,9 @@ class DmsfWorkflowsController < ApplicationController recipients = @dmsf_workflow.participiants recipients.push User.find_by_id revision.dmsf_workflow_assigned_by recipients.uniq! + if User.current && User.current.logged? && User.current.pref.no_self_notified + recipients.delete User.current + end recipients.each do |user| DmsfMailer.workflow_notification( user, @@ -315,6 +325,9 @@ class DmsfWorkflowsController < ApplicationController if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1' recipients = assignments.collect { |a| a.user } recipients.uniq! + if User.current && User.current.logged? && User.current.pref.no_self_notified + recipients.delete User.current + end unless recipients.empty? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')