Merge pull request #462 from foodcoop1040/message_undeleted

Send messages only to users which have not been deleted
This commit is contained in:
wvengen 2017-02-16 00:24:57 +01:00 committed by GitHub
commit c32593d682

View file

@ -35,7 +35,7 @@ class Message < ActiveRecord::Base
def clean_up_recipient_ids def clean_up_recipient_ids
add_recipients Group.find(group_id).users unless group_id.blank? add_recipients Group.find(group_id).users unless group_id.blank?
self.recipients_ids = recipients_ids.uniq.reject { |id| id.blank? } unless recipients_ids.nil? self.recipients_ids = recipients_ids.uniq.reject { |id| id.blank? } unless recipients_ids.nil?
self.recipients_ids = User.all.collect(&:id) if send_to_all == "1" self.recipients_ids = User.undeleted.collect(&:id) if send_to_all == "1"
end end
def add_recipients(users) def add_recipients(users)