Skip to content

Change ownership of issues/comments/PR from Github user to Gitea user after migration #7410

Closed
@mrsdizzie

Description

@mrsdizzie

Now that #7293 has happened, I think we have a good path to give ownership of migrated issues/comments/PRs to local Gitea users after a repo is migrated from Github.

When migrating, we store the Github user ID in the issues and comments table as original_author_id which means that we can match them if admin sets up Github as Authentication Source and a local user links their Github account.

For changing ownership we should create a task that compares external_login_id from external_users_table with original_author_id in issues/comments. Then change the poster_id of the issue/comment from the user who ran the migration to the local Gitea user who has a matching Github ID (external_login_user.user_id).

At this time we should also NULL the original_author string so the templates show the new Gitea user information and behave as normal.

I think we should offer this in 3 areas:

  • After the migration is run we should see if any of the items migrated match an already authenticated user and change the ownership then.

  • When somebody uses Github to authenticate we should see if their Github user ID is present in any migrated comments that still have original_author string and change ownership then

  • There should also be a simple interface in the admin area to manually input a original_author_id and choose an existing local user to assign the issues/comments too. This would give admin full control over what accounts are linked to what issues/comments and let them also revert any previous ownership change/run the task again if an error occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/enhancementAn improvement of existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions