From 3de819b68be3eee3d1e95996befbd2977052ffad Mon Sep 17 00:00:00 2001 From: Mohamed El-Sawy Date: Sun, 4 Aug 2024 23:53:20 +0300 Subject: [PATCH] CV2-5002: fix sentry issue (#1978) * CV2-5002: fix sentry issue * CV2-5002: fix tests --- app/models/bot/alegre.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/bot/alegre.rb b/app/models/bot/alegre.rb index 7a22aa9b8d..b7e4488040 100644 --- a/app/models/bot/alegre.rb +++ b/app/models/bot/alegre.rb @@ -611,7 +611,7 @@ def self.is_suggested_to_trash(source, target, relationship_type) end def self.create_relationship(source, target, pm_id_scores, relationship_type, original_source=nil, original_relationship_type=nil) - return nil if !self.can_create_relationship?(source, target, relationship_type) + return nil if source&.id == target&.id || !self.can_create_relationship?(source, target, relationship_type) r = Relationship.where(source_id: source.id, target_id: target.id) .where('relationship_type = ? OR relationship_type = ?', Relationship.confirmed_type.to_yaml, Relationship.suggested_type.to_yaml).last if r.nil?