diff options
author | qwerty287 <80460567+qwerty287@users.noreply.github.com> | 2021-12-17 22:29:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-17 21:29:09 +0000 |
commit | 4cbc865d835eb49722d22f8ac5019ccc17582a16 (patch) | |
tree | 2a679577d7d6560a8f45aba6a06d945e75e85e82 /routers | |
parent | 4bbbf356547557bd6b36d1d6cb73540a5febf120 (diff) | |
download | gitea-4cbc865d835eb49722d22f8ac5019ccc17582a16.tar.gz gitea-4cbc865d835eb49722d22f8ac5019ccc17582a16.zip |
Add option to define refs in issue templates (#17842)
Adds a markdown header option `ref` that allows you to set the ref the issue should belong.
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/issue.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index fe015145bd..17c72c13fe 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -776,6 +776,8 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleDirs [ } ctx.Data["HasSelectedLabel"] = len(labelIDs) > 0 ctx.Data["label_ids"] = strings.Join(labelIDs, ",") + ctx.Data["Reference"] = meta.Ref + ctx.Data["RefEndName"] = git.RefEndName(meta.Ref) return } } @@ -1635,6 +1637,7 @@ func ViewIssue(ctx *context.Context) { ctx.Data["Participants"] = participants ctx.Data["NumParticipants"] = len(participants) ctx.Data["Issue"] = issue + ctx.Data["Reference"] = issue.Ref ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login?redirect_to=" + url.QueryEscape(ctx.Data["Link"].(string)) ctx.Data["IsIssuePoster"] = ctx.IsSigned && issue.IsPoster(ctx.User.ID) ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) |