Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename a repository twice, then the first rename action target became the latest name. #18007

Open
lunny opened this issue Dec 17, 2021 · 4 comments
Labels

Comments

@lunny
Copy link
Member

lunny commented Dec 17, 2021

At first, rename repository A -> B, the action in dashboard displayed "xxx renamed A -> B".

Then rename B -> C, now there are two actions, the first one is "xxx renamed A -> C", the latest one is "xxx renamed B -> C".

I think because when rename, the target repository stored the repository id in the table but not the target name.

@lunny lunny added the type/bug label Dec 17, 2021
@Viktor-Yakovchuk
Copy link
Contributor

Hello, I have managed to fix this issue, but it manifests itself not only in renaming repo, but on all actions. For example, when we create issue (issue created in A) and rename repo (A->B), action with issu contains newest repo name (issue created in B), so as action with creation repo.
So do we need to replace ShortRepoPath call for new function in any place for each type of action in feed?
We can also rewrite ShortRepoPath but is it proper to all over cases?

@lunny
Copy link
Member Author

lunny commented Dec 23, 2021

I think yes, we need store the current name of that time in to database, maybe a new column?(need to check). So if add a new column, we need a migration. But the migration cannot do the right thing, because we have lost them. We can make future things right only.

@Viktor-Yakovchuk
Copy link
Contributor

I fix this issue without changing database. We can restore actual name of repo by following actions. So the question is should I change ShortRepoPath and change behavior for all dependencies or fix it only for feed by adding new function special for it?

Viktor-Yakovchuk pushed a commit to Viktor-Yakovchuk/gitea that referenced this issue Dec 23, 2021
* Fix Rename a repository twice, then the first rename action target became the latest name. go-gitea#18007

Change ShortRepoPath to return new repo path instead of recent repo path:
ShortRepoPath always returned actual repo name instead of new repo name according to the action:
A->C, B->C instead of A->B, B->C
Now it returns proper repo name.

Fix go-gitea#18007

Signed-off-by: Viktor Yakovchuk <viktor@yakovchuk.net>
@Viktor-Yakovchuk
Copy link
Contributor

@lunny can you take a look, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants