This commit is contained in:
@@ -7,9 +7,9 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/markup"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
repo_model "gitea.dev/models/repo"
|
||||
"gitea.dev/modules/markup"
|
||||
"gitea.dev/modules/util"
|
||||
)
|
||||
|
||||
type RepoComment struct {
|
||||
@@ -34,7 +34,7 @@ func (r *RepoComment) ResolveLink(link, preferLinkType string) string {
|
||||
case markup.LinkTypeRoot:
|
||||
return r.ctx.ResolveLinkRoot(link)
|
||||
default:
|
||||
return r.ctx.ResolveLinkRelative(r.repoLink, r.opts.CurrentRefPath, link)
|
||||
return r.ctx.ResolveLinkRelative(r.repoLink, r.opts.CurrentRefSubURL, link)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ var _ markup.RenderHelper = (*RepoComment)(nil)
|
||||
type RepoCommentOptions struct {
|
||||
DeprecatedRepoName string // it is only a patch for the non-standard "markup" api
|
||||
DeprecatedOwnerName string // it is only a patch for the non-standard "markup" api
|
||||
CurrentRefPath string // eg: "branch/main" or "commit/11223344"
|
||||
CurrentRefSubURL string // eg: "branch/main" or "commit/11223344"
|
||||
FootnoteContextID string // the extra context ID for footnotes, used to avoid conflicts with other footnotes in the same page
|
||||
}
|
||||
|
||||
@@ -51,10 +51,10 @@ func NewRenderContextRepoComment(ctx context.Context, repo *repo_model.Repositor
|
||||
helper := &RepoComment{opts: util.OptionalArg(opts)}
|
||||
rctx := markup.NewRenderContext(ctx)
|
||||
helper.ctx = rctx
|
||||
helper.commitChecker = newCommitChecker(ctx, repo)
|
||||
var metas map[string]string
|
||||
if repo != nil {
|
||||
helper.repoLink = repo.Link()
|
||||
helper.commitChecker = newCommitChecker(ctx, repo)
|
||||
metas = repo.ComposeCommentMetas(ctx)
|
||||
} else {
|
||||
// repo can be nil when rendering a commit message in user's dashboard feedback whose repository has been deleted
|
||||
|
||||
Reference in New Issue
Block a user