aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo_redirect.go
diff options
context:
space:
mode:
authorAndrew Bezold <andrew.bezold@gmail.com>2021-01-24 10:23:05 -0500
committerGitHub <noreply@github.com>2021-01-24 16:23:05 +0100
commitbc05ddc0ebd6fdc826ef2beec99304bac60ddd8a (patch)
tree03d52e07feedd37e169a04980f9efbb8bd1aca65 /models/repo_redirect.go
parent4f608ad31f538cb45411ff9a2238db812b5ca414 (diff)
downloadgitea-bc05ddc0ebd6fdc826ef2beec99304bac60ddd8a.tar.gz
gitea-bc05ddc0ebd6fdc826ef2beec99304bac60ddd8a.zip
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>
Diffstat (limited to 'models/repo_redirect.go')
-rw-r--r--models/repo_redirect.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/models/repo_redirect.go b/models/repo_redirect.go
index 182b6b41a2..afbfeb499e 100644
--- a/models/repo_redirect.go
+++ b/models/repo_redirect.go
@@ -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,