Skip to content

Add command to fix user duplicates#2047

Merged
BentiGorlich merged 6 commits intomainfrom
fix/username-messup
Mar 29, 2026
Merged

Add command to fix user duplicates#2047
BentiGorlich merged 6 commits intomainfrom
fix/username-messup

Conversation

@BentiGorlich
Copy link
Copy Markdown
Member

  • make the ActivityPubManager update the username as well
  • Add a command to fix duplicate usernames, either by refreshing the remote actors or by merging the users together

- make the `ActivityPubManager` update the username as well
- Add a command to fix duplicate usernames, either by refreshing the remote actors or by merging the users together
@BentiGorlich BentiGorlich self-assigned this Mar 10, 2026
@BentiGorlich BentiGorlich added enhancement New feature or request activitypub ActivityPub related issues backend Backend related issues and pull requests labels Mar 10, 2026
@melroy89
Copy link
Copy Markdown
Member

We already have a command that checks for user duplicates. I know that that command didn't found these issues.. Nevertheless, it would be better for the end user to just have 1 command to once and for all fix user duplicates. 😊

@BentiGorlich
Copy link
Copy Markdown
Member Author

True, I forgot about that. I will try to consolidate the 2 commands 👍

@BentiGorlich BentiGorlich marked this pull request as draft March 10, 2026 16:24
@blued-gear
Copy link
Copy Markdown
Collaborator

What happens with mentions when a user changed their handle? I expect in the current situation they will just be broken, right?

@BentiGorlich
Copy link
Copy Markdown
Member Author

What happens with mentions when a user changed their handle? I expect in the current situation they will just be broken, right?

Yes it would just be broken

@BentiGorlich BentiGorlich marked this pull request as ready for review March 29, 2026 15:00
Comment thread src/Service/ActivityPubManager.php Outdated
$user->type = $actor['type'] ?? 'Person';
$user->apInboxUrl = $actor['endpoints']['sharedInbox'] ?? $actor['inbox'];
$user->apDomain = parse_url($actor['id'], PHP_URL_HOST);
$user->username = '@'.($actor['preferredUsername'] ?? $user->username).'@'.$user->apDomain;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a log when the handle changed. This way we can create some statistics to estimate if we need to fix possible broken mentions.

Comment thread src/Command/CheckDuplicatesUsersMagazines.php
Comment thread src/Command/CheckDuplicatesUsersMagazines.php
- Put all the updates in the command into a transaction
- added update cases for magazine bans and activity objects
- added logging for changing the handle while updating a user. Also fix the logic there a bit
@BentiGorlich BentiGorlich enabled auto-merge (squash) March 29, 2026 18:43
@BentiGorlich BentiGorlich merged commit 5a59411 into main Mar 29, 2026
9 checks passed
@BentiGorlich BentiGorlich deleted the fix/username-messup branch March 29, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

activitypub ActivityPub related issues backend Backend related issues and pull requests enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants