diff --git a/models/action.go b/models/action.go index efb4eaaf0..d39209c44 100644 --- a/models/action.go +++ b/models/action.go @@ -517,7 +517,7 @@ func CommitRepoAction( Before: oldCommitID, After: newCommitID, CompareUrl: setting.AppUrl + commit.CompareUrl, - Commits: commit.ToApiPayloadCommits(repo.FullRepoLink()), + Commits: commit.ToApiPayloadCommits(repo.FullLink()), Repo: payloadRepo, Pusher: &api.PayloadAuthor{ Name: pusher_name, diff --git a/models/pull.go b/models/pull.go index 86ddb5d94..8ef0cc643 100644 --- a/models/pull.go +++ b/models/pull.go @@ -236,7 +236,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error Before: pr.MergeBase, After: pr.MergedCommitID, CompareUrl: setting.AppUrl + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID), - Commits: ListToPushCommits(l).ToApiPayloadCommits(pr.BaseRepo.FullRepoLink()), + Commits: ListToPushCommits(l).ToApiPayloadCommits(pr.BaseRepo.FullLink()), Repo: pr.BaseRepo.ComposePayload(), Pusher: &api.PayloadAuthor{ Name: pr.HeadRepo.MustOwner().DisplayName(), diff --git a/models/repo.go b/models/repo.go index 78f1511c9..f8782db71 100644 --- a/models/repo.go +++ b/models/repo.go @@ -346,11 +346,11 @@ func (repo *Repository) GitConfigPath() string { return filepath.Join(repo.RepoPath(), "config") } -func (repo *Repository) RepoLink() string { +func (repo *Repository) Link() string { return setting.AppSubUrl + "/" + repo.MustOwner().Name + "/" + repo.Name } -func (repo *Repository) RepoRelLink() string { +func (repo *Repository) RelLink() string { return "/" + repo.MustOwner().Name + "/" + repo.Name } @@ -358,7 +358,7 @@ func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) strin return fmt.Sprintf("%s/%s/compare/%s...%s", repo.MustOwner().Name, repo.Name, oldCommitID, newCommitID) } -func (repo *Repository) FullRepoLink() string { +func (repo *Repository) FullLink() string { return setting.AppUrl + repo.MustOwner().Name + "/" + repo.Name } @@ -459,7 +459,7 @@ func (repo *Repository) ComposePayload() *api.PayloadRepo { return &api.PayloadRepo{ ID: repo.ID, Name: repo.Name, - URL: repo.FullRepoLink(), + URL: repo.FullLink(), SSHURL: cl.SSH, CloneURL: cl.HTTPS, Description: repo.Description, diff --git a/modules/context/repo.go b/modules/context/repo.go index a7ca17d3b..f68576ff5 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -174,7 +174,7 @@ func RepoAssignment(args ...bool) macaron.Handler { return } ctx.Repo.GitRepo = gitRepo - ctx.Repo.RepoLink = repo.RepoLink() + ctx.Repo.RepoLink = repo.Link() ctx.Data["RepoLink"] = ctx.Repo.RepoLink ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name diff --git a/routers/repo/pull.go b/routers/repo/pull.go index 922d64ef4..da1ee1499 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -531,7 +531,7 @@ func PrepareCompareDiff( ) // Get diff information. - ctx.Data["CommitRepoLink"] = headRepo.RepoLink() + ctx.Data["CommitRepoLink"] = headRepo.Link() headCommitID, err := headGitRepo.GetBranchCommitID(headBranch) if err != nil { diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 14d296365..6fd195aa1 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -122,7 +122,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { } ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) - ctx.Redirect(repo.RepoLink() + "/settings") + ctx.Redirect(repo.Link() + "/settings") case "advanced": repo.EnableWiki = form.EnableWiki diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index 460a430aa..d90486235 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -349,7 +349,7 @@ func TestWebhook(ctx *context.Context) { { ID: ctx.Repo.CommitID, Message: ctx.Repo.Commit.Message(), - URL: ctx.Repo.Repository.FullRepoLink() + "/commit/" + ctx.Repo.CommitID, + URL: ctx.Repo.Repository.FullLink() + "/commit/" + ctx.Repo.CommitID, Author: &api.PayloadAuthor{ Name: ctx.Repo.Commit.Author.Name, Email: ctx.Repo.Commit.Author.Email, diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index dfb7673d3..1293fa431 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -10,7 +10,7 @@
/
{{.Name}} {{if .IsMirror}}
{{$.i18n.Tr "repo.mirror_from"}} {{$.Mirror.Address}}
{{end}} - {{if .IsFork}}
{{$.i18n.Tr "repo.forked_from"}} {{SubStr .BaseRepo.RepoRelLink 1 -1}}
{{end}} + {{if .IsFork}}
{{$.i18n.Tr "repo.forked_from"}} {{SubStr .BaseRepo.RepoRelLink 1 -1}}
{{end}}
@@ -18,7 +18,7 @@ {{if $.IsWatchingRepo}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{$.i18n.Tr "repo.watch"}}{{end}} - + {{.NumWatches}}
@@ -26,7 +26,7 @@ {{if $.IsStaringRepo}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{$.i18n.Tr "repo.star"}}{{end}} - + {{.NumStars}} @@ -35,7 +35,7 @@ {{$.i18n.Tr "repo.fork"}} - + {{.NumForks}}