From 2f0f080687cb6352671b1d91513e1a92c641b568 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 30 Aug 2016 15:18:42 +0800 Subject: [PATCH] now approvers for the category only get the emails --- app/helpers/admin/announcements_helper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helpers/admin/announcements_helper.rb b/app/helpers/admin/announcements_helper.rb index 4fc728f..57aff77 100644 --- a/app/helpers/admin/announcements_helper.rb +++ b/app/helpers/admin/announcements_helper.rb @@ -147,8 +147,9 @@ module Admin::AnnouncementsHelper users = users.concat(admins.to_a) end if @announcement_setting.email_to.include?("approvers") - approvers = User.find(@announcement_setting.approvers) rescue [] - users = users.concat(approvers.to_a) + approvers = User.find(@announcement_setting.approvers).to_a rescue [] + auths = Authorization.where(:category_id => announcement.category_id).collect{|a| a.user} + users = users.concat(approvers & auths) end users.each do |user| email = user.member_profile.email