From 7ba4efe30ce893a099aaa9a74c517f7d3c3fb340 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Mon, 11 Dec 2023 14:32:37 +0100 Subject: [PATCH] Fix recipients for my_module designation notifications [SCI-9863] --- app/models/user_my_module.rb | 2 -- .../recipients/designate_to_my_module_recipients.rb | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/user_my_module.rb b/app/models/user_my_module.rb index 8553630bb..d7c549c6c 100644 --- a/app/models/user_my_module.rb +++ b/app/models/user_my_module.rb @@ -9,8 +9,6 @@ class UserMyModule < ApplicationRecord belongs_to :my_module, inverse_of: :user_my_modules, touch: true def log_activity(type_of, current_user) - return if current_user.id == user.id - Activities::CreateActivityService .call(activity_type: type_of, owner: current_user, diff --git a/app/notifications/recipients/designate_to_my_module_recipients.rb b/app/notifications/recipients/designate_to_my_module_recipients.rb index dbc35e126..ef4c13363 100644 --- a/app/notifications/recipients/designate_to_my_module_recipients.rb +++ b/app/notifications/recipients/designate_to_my_module_recipients.rb @@ -7,7 +7,11 @@ module Recipients def activity_recipients activity = Activity.find(@params[:activity_id]) user = User.find_by(id: activity.values.dig('message_items', 'user_target', 'id')) + + return [] if user.id == activity.owner_id + [user] end end end +