diff options
Diffstat (limited to 'app/models/message.rb')
-rw-r--r-- | app/models/message.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/message.rb b/app/models/message.rb index 67d87f6..922cae2 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -16,7 +16,7 @@ # License along with ECS. If not, see <http://www.gnu.org/licenses/>. -class Message < ActiveRecord::Base +class Message < ApplicationRecord require 'exceptions' @@ -64,7 +64,7 @@ class Message < ActiveRecord::Base request.headers["X-EcsReceiverMemberships"], request.headers["X-EcsReceiverCommunities"], participant) - Participant.for_message(message).uniq.each do |p| + Participant.for_message(message).distinct.each do |p| Event.make(:event_type_name => EvType.find(1).name, :participant => p, :message => message) end if message.ressource.events if app_namespace == 'sys' and ressource_name == 'auths' @@ -90,14 +90,14 @@ class Message < ActiveRecord::Base # by converting ActiveRecord::Relation to an array of Model-Objects. We could # have done this # also by calling #load!, but would have get back still an # ActiveRecord::Relation, which works also. - receivers_old = Participant.for_message(self).uniq.to_a + receivers_old = Participant.for_message(self).distinct.to_a #puts "*** receivers_old: #{receivers_old.inspect}" MembershipMessage.de_populate_jointable(self) MembershipMessage.populate_jointable(self, request.headers["X-EcsReceiverMemberships"], request.headers["X-EcsReceiverCommunities"], participant) - receivers_new = Participant.for_message(self).uniq.to_a + receivers_new = Participant.for_message(self).distinct.to_a # TODO: if there are only the headers X-EcsReceiverMemberships and # X-EcsReceiverCommunities are updated, then we have to generate events only # for these new and removed receivers. To distinguish if the message body @@ -273,7 +273,7 @@ class Message < ActiveRecord::Base # deleted when there are no references from any events otherwise it will be # tagged as deleted. def destroy_as_sender - participants = Participant.for_message(self).uniq + participants = Participant.for_message(self).distinct participants.each do |participant| Event.make(:event_type_name => EvType.find(2).name, :participant => participant, :message => self) end if ressource.events |