gestionnaire: ignore when the gestionnaire already follows the dossier
Fix #3720
This commit is contained in:
parent
b83ef3cbb4
commit
1f955db2c7
1 changed files with 12 additions and 1 deletions
|
@ -31,7 +31,18 @@ class Gestionnaire < ApplicationRecord
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
followed_dossiers << dossier
|
begin
|
||||||
|
followed_dossiers << dossier
|
||||||
|
rescue ActiveRecord::RecordNotUnique
|
||||||
|
# Altough we checked before the insertion that the gestionnaire wasn't
|
||||||
|
# already following this dossier, this was done at the Rails level:
|
||||||
|
# at the database level, the dossier was already followed, and a
|
||||||
|
# "invalid constraint" exception is raised.
|
||||||
|
#
|
||||||
|
# We can ignore this safely, as it means the goal is already reached:
|
||||||
|
# the gestionnaire follows the dossier.
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def unfollow(dossier)
|
def unfollow(dossier)
|
||||||
|
|
Loading…
Reference in a new issue