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?