Closed desnoes closed 6 years ago
Note: should rather be an API issue because most of the tasks are performed on the API side.
@desnoes Should this tool be available form the UI (website)? If yes, who should be able to merge accounts? Moderators? Or should we keep the v5-approach (a script to run by hand in the server command line)?
Note: source of v5 command line tool https://github.com/c2corg/camptocamp.org/blob/master/batch/mergeUsers.php
Some tasks from the document merging or deleting tools could perhaps be reused:
Discourse tasks:
Guidebook tasks:
user_ids
attributeIf command line interface:
docker-compose run --rm api .build/venv/bin/python c2corg_api/scripts/admin/merge_users.py <source id> <target id>
@arnaud-morvan Sounds good to you?
If web interface is needed (is it??): TBD
I trust you on the topoguide side, there is a bunch of relationships with users, but this sounds reasonably feasible, as we have direct access to ORM, so this can be done in one request / transaction.
I've already done that sort of stuff in discourse, because some users have changed their email during forum migration, see : https://github.com/c2corg/v6_forum/issues/90.
So I've searched for user's posts and manually changed owner one by one on each post through discourse UI (passing through ORM). As far as I know, there is no discourse tool to do this as batch (and I've searched for). This may be possible through Discourse API, but it should result in a lot of requests, not included in a transaction, and we may encounter an error in the middle of process.
Concerning private messages, I've done it directly in SQL, but this is not the recommended way of changing data in discourse. No idea if this is possible through API. Note that Topoguide API process do not have direct access to discourse database.
There should be other thing related to users in discourse, but this not really relevant I suppose. After changing posts owner, I was able to delete the user.
@desnoes Should this tool be available form the UI (website)? If yes, who should be able to merge accounts? Moderators? Or should we keep the v5-approach (a script to run by hand in the server command line)?
I have no experience in merging account. Was it frequent in V5 ? If not and running a script by hand is not too cumbersome, let's go for it.
I have no experience in merging account. Was it frequent in V5 ? If not and running a script by hand is not too cumbersome, let's go for it.
Merging an account is also used to delete an account, as all spamer accounts. With spamers ang regular users, we need merge about 100 to 200 account per year.
I have no experience in merging account. Was it frequent in V5 ?
Use cases are:
For the spammers, in v5 those accounts were either deleted or merged with the "compte fermé", especially when all there messages had not been deleted yet. There were 2 scripts, 1 for deleting and 1 for merging. In v6 is it complicated to remove spam messages? Anyway the accounts have to be removed, so perhaps it is better to stick to the merging procedure instead of developing a special "deleting" tool for those accounts.
2 tools could be created:
Pros:
Cons:
Pros:
Cons:
The API PR https://github.com/c2corg/v6_api/pull/660 has finally been merged. Please note it has no impact on the Discourse side.
@desnoes @asaunier it is in prod ?
Yes but never tested
I have created and modified some documents in order to have some test cases for testing the merge of accounts.
Compte à fusionner avec 'compte fermé':
login: bouvier1
ID: 855289
[x] Sortie créé (un seul utilisateur): https://www.demov6.camptocamp.org/outings/951503/fr/pas-de-vauclave-traversee-egreatergreaterw-de-chialvetta-a-larche
[x] Sortie créé (2 utilisateurs: bouvier1 et Alex Saunier) pour voir l'historique des versions: https://www.demov6.camptocamp.org/outings/951504/fr/pas-de-vauclave-traversee-egreatergreaterw-de-chialvetta-a-larche
[x] Iti créé : https://www.demov6.camptocamp.org/routes/951505/fr/essai-fusion-comptes
[x] Iti modifié pour voir l'historique des versions : https://www.demov6.camptocamp.org/routes/45607/fr/chamechaude-versant-w
[x] WP créé: https://www.demov6.camptocamp.org/waypoints/951506/fr/essai-fusion-comptes
[x] WP modifié (pour voir l'historique des versions) : https://www.demov6.camptocamp.org/waypoints/37370/fr/chamechaude
[x] Article créé : https://www.demov6.camptocamp.org/articles/951507/fr/essai-fusion-comptes
[x] Article modifié (pour voir l'historique des versions) : https://www.demov6.camptocamp.org/articles/950855/fr/questions-et-reponses-a-propos-de-camptocamp-association
[x] xreport créé: https://www.demov6.camptocamp.org/xreports/951508/fr/essai-fusion-comptes
[x] Image créée: https://www.demov6.camptocamp.org/images/951509/fr/essai-fusion-comptes
@desnoes dans tes tests, il faudrait ajouter l'ajout de photos.
@desnoes Could you remind me the id of "compte fermé" ?
@desnoes Merge done on the demo.
@asaunier: Many thanks. All the tests are ok. We can put this PR in prod.
@desnoes Actually the PR has been merged weeks or months ago and is already in prod :P
It should be possible to merge 2 users accounts. At least an user with 'compte fermé'. The identifiers (topo and forum) of a merged account shall not be visible in any document and in the forum. All documents that have been created or modified shall be updated. All the messages of the forum shall be updated.