mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Redirect on changed user and org name (#11649)
* Add redirect for user * Add redirect for orgs * Add user redirect test * Appease linter * Add comment to DeleteUserRedirect function * Fix locale changes * Fix GetUserByParams * Fix orgAssignment * Remove debug logging * Add redirect prompt * Dont Export DeleteUserRedirect & only use it within a session * Unexport newUserRedirect * cleanup * Fix & Dedub API code * Format Template * Add Migration & rm dublicat * Refactor: unexport newRepoRedirect() & rm dedub del exec * if this fails we'll need to re-rename the user directory Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
4f608ad31f
commit
bc05ddc0eb
25 changed files with 325 additions and 64 deletions
|
@ -28,16 +28,16 @@ func LookupRepoRedirect(ownerID int64, repoName string) (int64, error) {
|
|||
return redirect.RedirectRepoID, nil
|
||||
}
|
||||
|
||||
// NewRepoRedirect create a new repo redirect
|
||||
func NewRepoRedirect(ctx DBContext, ownerID, repoID int64, oldRepoName, newRepoName string) error {
|
||||
// newRepoRedirect create a new repo redirect
|
||||
func newRepoRedirect(e Engine, ownerID, repoID int64, oldRepoName, newRepoName string) error {
|
||||
oldRepoName = strings.ToLower(oldRepoName)
|
||||
newRepoName = strings.ToLower(newRepoName)
|
||||
|
||||
if err := deleteRepoRedirect(ctx.e, ownerID, newRepoName); err != nil {
|
||||
if err := deleteRepoRedirect(e, ownerID, newRepoName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := ctx.e.Insert(&RepoRedirect{
|
||||
if _, err := e.Insert(&RepoRedirect{
|
||||
OwnerID: ownerID,
|
||||
LowerName: oldRepoName,
|
||||
RedirectRepoID: repoID,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue