mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-28 04:36:11 +01:00
models/repo: remove redundant info for some repo methods
RepoLink -> Link, RepoRelLink -> RelLink, FullRepoLink -> FullLink
This commit is contained in:
parent
194a742fb9
commit
7ca5f8f119
|
@ -517,7 +517,7 @@ func CommitRepoAction(
|
||||||
Before: oldCommitID,
|
Before: oldCommitID,
|
||||||
After: newCommitID,
|
After: newCommitID,
|
||||||
CompareUrl: setting.AppUrl + commit.CompareUrl,
|
CompareUrl: setting.AppUrl + commit.CompareUrl,
|
||||||
Commits: commit.ToApiPayloadCommits(repo.FullRepoLink()),
|
Commits: commit.ToApiPayloadCommits(repo.FullLink()),
|
||||||
Repo: payloadRepo,
|
Repo: payloadRepo,
|
||||||
Pusher: &api.PayloadAuthor{
|
Pusher: &api.PayloadAuthor{
|
||||||
Name: pusher_name,
|
Name: pusher_name,
|
||||||
|
|
|
@ -236,7 +236,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
|
||||||
Before: pr.MergeBase,
|
Before: pr.MergeBase,
|
||||||
After: pr.MergedCommitID,
|
After: pr.MergedCommitID,
|
||||||
CompareUrl: setting.AppUrl + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, 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(),
|
Repo: pr.BaseRepo.ComposePayload(),
|
||||||
Pusher: &api.PayloadAuthor{
|
Pusher: &api.PayloadAuthor{
|
||||||
Name: pr.HeadRepo.MustOwner().DisplayName(),
|
Name: pr.HeadRepo.MustOwner().DisplayName(),
|
||||||
|
|
|
@ -346,11 +346,11 @@ func (repo *Repository) GitConfigPath() string {
|
||||||
return filepath.Join(repo.RepoPath(), "config")
|
return filepath.Join(repo.RepoPath(), "config")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) RepoLink() string {
|
func (repo *Repository) Link() string {
|
||||||
return setting.AppSubUrl + "/" + repo.MustOwner().Name + "/" + repo.Name
|
return setting.AppSubUrl + "/" + repo.MustOwner().Name + "/" + repo.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) RepoRelLink() string {
|
func (repo *Repository) RelLink() string {
|
||||||
return "/" + repo.MustOwner().Name + "/" + repo.Name
|
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)
|
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
|
return setting.AppUrl + repo.MustOwner().Name + "/" + repo.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ func (repo *Repository) ComposePayload() *api.PayloadRepo {
|
||||||
return &api.PayloadRepo{
|
return &api.PayloadRepo{
|
||||||
ID: repo.ID,
|
ID: repo.ID,
|
||||||
Name: repo.Name,
|
Name: repo.Name,
|
||||||
URL: repo.FullRepoLink(),
|
URL: repo.FullLink(),
|
||||||
SSHURL: cl.SSH,
|
SSHURL: cl.SSH,
|
||||||
CloneURL: cl.HTTPS,
|
CloneURL: cl.HTTPS,
|
||||||
Description: repo.Description,
|
Description: repo.Description,
|
||||||
|
|
|
@ -174,7 +174,7 @@ func RepoAssignment(args ...bool) macaron.Handler {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Repo.GitRepo = gitRepo
|
ctx.Repo.GitRepo = gitRepo
|
||||||
ctx.Repo.RepoLink = repo.RepoLink()
|
ctx.Repo.RepoLink = repo.Link()
|
||||||
ctx.Data["RepoLink"] = ctx.Repo.RepoLink
|
ctx.Data["RepoLink"] = ctx.Repo.RepoLink
|
||||||
ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name
|
ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name
|
||||||
|
|
||||||
|
|
|
@ -531,7 +531,7 @@ func PrepareCompareDiff(
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get diff information.
|
// Get diff information.
|
||||||
ctx.Data["CommitRepoLink"] = headRepo.RepoLink()
|
ctx.Data["CommitRepoLink"] = headRepo.Link()
|
||||||
|
|
||||||
headCommitID, err := headGitRepo.GetBranchCommitID(headBranch)
|
headCommitID, err := headGitRepo.GetBranchCommitID(headBranch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -122,7 +122,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success"))
|
ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success"))
|
||||||
ctx.Redirect(repo.RepoLink() + "/settings")
|
ctx.Redirect(repo.Link() + "/settings")
|
||||||
|
|
||||||
case "advanced":
|
case "advanced":
|
||||||
repo.EnableWiki = form.EnableWiki
|
repo.EnableWiki = form.EnableWiki
|
||||||
|
|
|
@ -349,7 +349,7 @@ func TestWebhook(ctx *context.Context) {
|
||||||
{
|
{
|
||||||
ID: ctx.Repo.CommitID,
|
ID: ctx.Repo.CommitID,
|
||||||
Message: ctx.Repo.Commit.Message(),
|
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{
|
Author: &api.PayloadAuthor{
|
||||||
Name: ctx.Repo.Commit.Author.Name,
|
Name: ctx.Repo.Commit.Author.Name,
|
||||||
Email: ctx.Repo.Commit.Author.Email,
|
Email: ctx.Repo.Commit.Author.Email,
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="divider"> / </div>
|
<div class="divider"> / </div>
|
||||||
<a href="{{$.RepoLink}}">{{.Name}}</a>
|
<a href="{{$.RepoLink}}">{{.Name}}</a>
|
||||||
{{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" href="{{$.Mirror.Address}}">{{$.Mirror.Address}}</a></div>{{end}}
|
{{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" href="{{$.Mirror.Address}}">{{$.Mirror.Address}}</a></div>{{end}}
|
||||||
{{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.RepoLink}}">{{SubStr .BaseRepo.RepoRelLink 1 -1}}</a></div>{{end}}
|
{{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{SubStr .BaseRepo.RepoRelLink 1 -1}}</a></div>{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui right">
|
<div class="ui right">
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<a class="ui button" href="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}">
|
<a class="ui button" href="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}">
|
||||||
<i class="icon fa-eye{{if not $.IsWatchingRepo}}-slash{{end}}"></i>{{if $.IsWatchingRepo}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{$.i18n.Tr "repo.watch"}}{{end}}
|
<i class="icon fa-eye{{if not $.IsWatchingRepo}}-slash{{end}}"></i>{{if $.IsWatchingRepo}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{$.i18n.Tr "repo.watch"}}{{end}}
|
||||||
</a>
|
</a>
|
||||||
<a class="ui basic label" href="{{.RepoLink}}/watchers">
|
<a class="ui basic label" href="{{.Link}}/watchers">
|
||||||
{{.NumWatches}}
|
{{.NumWatches}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<a class="ui button" href="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
|
<a class="ui button" href="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
|
||||||
<i class="icon fa-star{{if not $.IsStaringRepo}}-o{{end}}"></i>{{if $.IsStaringRepo}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{$.i18n.Tr "repo.star"}}{{end}}
|
<i class="icon fa-star{{if not $.IsStaringRepo}}-o{{end}}"></i>{{if $.IsStaringRepo}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{$.i18n.Tr "repo.star"}}{{end}}
|
||||||
</a>
|
</a>
|
||||||
<a class="ui basic label" href="{{.RepoLink}}/stars">
|
<a class="ui basic label" href="{{.Link}}/stars">
|
||||||
{{.NumStars}}
|
{{.NumStars}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
<a class="ui button {{if eq .OwnerID $.SignedUserID}}poping up{{end}}" {{if not (eq .OwnerID $.SignedUserID)}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
|
<a class="ui button {{if eq .OwnerID $.SignedUserID}}poping up{{end}}" {{if not (eq .OwnerID $.SignedUserID)}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
|
||||||
<i class="icon octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
|
<i class="icon octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
|
||||||
</a>
|
</a>
|
||||||
<a class="ui basic label" href="{{.RepoLink}}/forks">
|
<a class="ui basic label" href="{{.Link}}/forks">
|
||||||
{{.NumForks}}
|
{{.NumForks}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue