Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider a3378ae7 rédigé par cmrd Senya's avatar cmrd Senya Validation de Benjamin Neff
Parcourir les fichiers

Account merging: handle duplicates for TagFollowing

I missed it in #7803

closes #7807
parent cb294fd3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
## Refactor ## Refactor
* Add unique index to poll participations on `poll_id` and `author_id` [#7798](https://github.com/diaspora/diaspora/pull/7798) * Add unique index to poll participations on `poll_id` and `author_id` [#7798](https://github.com/diaspora/diaspora/pull/7798)
* Add 'completed at' date to account migrations [#7805](https://github.com/diaspora/diaspora/pull/7805) * Add 'completed at' date to account migrations [#7805](https://github.com/diaspora/diaspora/pull/7805)
* Handle duplicates for TagFollowing on account merging [#7807](https://github.com/diaspora/diaspora/pull/7807)
## Bug fixes ## Bug fixes
......
...@@ -194,6 +194,10 @@ class AccountMigration < ApplicationRecord ...@@ -194,6 +194,10 @@ class AccountMigration < ApplicationRecord
.joins("INNER JOIN contacts as c2 ON (contacts.person_id = c2.person_id AND contacts.user_id=#{old_user.id} AND"\ .joins("INNER JOIN contacts as c2 ON (contacts.person_id = c2.person_id AND contacts.user_id=#{old_user.id} AND"\
" c2.user_id=#{new_user.id})") " c2.user_id=#{new_user.id})")
.destroy_all .destroy_all
TagFollowing
.joins("INNER JOIN tag_followings as t2 ON (tag_followings.tag_id = t2.tag_id AND"\
" tag_followings.user_id=#{old_user.id} AND t2.user_id=#{new_user.id})")
.destroy_all
end end
def update_person_references def update_person_references
......
...@@ -210,6 +210,11 @@ describe AccountMigration, type: :model do ...@@ -210,6 +210,11 @@ describe AccountMigration, type: :model do
user: new_person.owner, user: new_person.owner,
person: FactoryGirl.create(:contact, user: old_person.owner).person person: FactoryGirl.create(:contact, user: old_person.owner).person
) )
FactoryGirl.create(
:tag_following,
user: new_person.owner,
tag: FactoryGirl.create(:tag_following, user: old_person.owner).tag
)
end end
it "runs without errors" do it "runs without errors" do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter