Unified link creation. (#15619)
This commit is contained in:
parent
1456978246
commit
c80d7f33b6
11 changed files with 27 additions and 24 deletions
|
@ -75,5 +75,5 @@ func CreatePost(ctx *context.Context) {
|
|||
}
|
||||
log.Trace("Organization created: %s", org.Name)
|
||||
|
||||
ctx.Redirect(setting.AppSubURL + "/org/" + form.OrgName + "/dashboard")
|
||||
ctx.Redirect(org.DashboardLink())
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
issue_service "code.gitea.io/gitea/services/issue"
|
||||
|
@ -88,7 +87,7 @@ func RetrieveLabels(ctx *context.Context) {
|
|||
ctx.ServerError("org.IsOwnedBy", err)
|
||||
return
|
||||
}
|
||||
ctx.Org.OrgLink = setting.AppSubURL + "/org/" + org.LowerName
|
||||
ctx.Org.OrgLink = org.OrganisationLink()
|
||||
ctx.Data["IsOrganizationOwner"] = ctx.Org.IsOwner
|
||||
ctx.Data["OrganizationLink"] = ctx.Org.OrgLink
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ func MigratePost(ctx *context.Context) {
|
|||
|
||||
err = task.MigrateRepository(ctx.User, ctxUser, opts)
|
||||
if err == nil {
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + opts.RepoName)
|
||||
ctx.Redirect(ctxUser.HomeLink() + "/" + opts.RepoName)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ func ForkPost(ctx *context.Context) {
|
|||
}
|
||||
repo, has := models.HasForkedRepo(ctxUser.ID, traverseParentRepo.ID)
|
||||
if has {
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
ctx.Redirect(ctxUser.HomeLink() + "/" + repo.Name)
|
||||
return
|
||||
}
|
||||
if !traverseParentRepo.IsFork {
|
||||
|
@ -243,7 +243,7 @@ func ForkPost(ctx *context.Context) {
|
|||
}
|
||||
|
||||
log.Trace("Repository forked[%d]: %s/%s", forkRepo.ID, ctxUser.Name, repo.Name)
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
ctx.Redirect(ctxUser.HomeLink() + "/" + repo.Name)
|
||||
}
|
||||
|
||||
func checkPullInfo(ctx *context.Context) *models.Issue {
|
||||
|
|
|
@ -240,7 +240,7 @@ func CreatePost(ctx *context.Context) {
|
|||
repo, err = repo_service.GenerateRepository(ctx.User, ctxUser, templateRepo, opts)
|
||||
if err == nil {
|
||||
log.Trace("Repository generated [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
ctx.Redirect(ctxUser.HomeLink() + "/" + repo.Name)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
|
@ -259,7 +259,7 @@ func CreatePost(ctx *context.Context) {
|
|||
})
|
||||
if err == nil {
|
||||
log.Trace("Repository created [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
ctx.Redirect(ctxUser.HomeLink() + "/" + repo.Name)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -500,7 +500,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
|
||||
log.Trace("Repository transfer process was started: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner)
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.transfer_started", newOwner.DisplayName()))
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctx.Repo.Owner.Name + "/" + repo.Name + "/settings")
|
||||
ctx.Redirect(ctx.Repo.Owner.HomeLink() + "/" + repo.Name + "/settings")
|
||||
|
||||
case "cancel_transfer":
|
||||
if !ctx.Repo.IsOwner() {
|
||||
|
@ -512,7 +512,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
if err != nil {
|
||||
if models.IsErrNoPendingTransfer(err) {
|
||||
ctx.Flash.Error("repo.settings.transfer_abort_invalid")
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctx.User.Name + "/" + repo.Name + "/settings")
|
||||
ctx.Redirect(ctx.User.HomeLink() + "/" + repo.Name + "/settings")
|
||||
} else {
|
||||
ctx.ServerError("GetPendingRepositoryTransfer", err)
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
|
||||
log.Trace("Repository transfer process was cancelled: %s/%s ", ctx.Repo.Owner.Name, repo.Name)
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.transfer_abort_success", repoTransfer.Recipient.Name))
|
||||
ctx.Redirect(setting.AppSubURL + "/" + ctx.Repo.Owner.Name + "/" + repo.Name + "/settings")
|
||||
ctx.Redirect(ctx.Repo.Owner.HomeLink() + "/" + repo.Name + "/settings")
|
||||
|
||||
case "delete":
|
||||
if !ctx.Repo.IsOwner() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue