summaryrefslogtreecommitdiffstats
path: root/models/issue_xref.go
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2019-11-18 14:03:49 -0300
committerLauris BH <lauris@nix.lv>2019-11-18 19:03:49 +0200
commit64769c8a6beb569053aef7d440bef8f193f1d1df (patch)
treeccac39c6d6deb6710baec7b3d771d7699e79ff12 /models/issue_xref.go
parentb15f26b1cf3dc976ae400d4a3c73ec3bd4a50bc6 (diff)
downloadgitea-64769c8a6beb569053aef7d440bef8f193f1d1df.tar.gz
gitea-64769c8a6beb569053aef7d440bef8f193f1d1df.zip
Allow authors to use act keywords in PR content (#9059)
Diffstat (limited to 'models/issue_xref.go')
-rw-r--r--models/issue_xref.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/models/issue_xref.go b/models/issue_xref.go
index 41937dc675..f41c154753 100644
--- a/models/issue_xref.go
+++ b/models/issue_xref.go
@@ -178,9 +178,14 @@ func (issue *Issue) verifyReferencedIssue(e Engine, ctx *crossReferencesContext,
if !perm.CanReadIssuesOrPulls(refIssue.IsPull) {
return nil, references.XRefActionNone, nil
}
+ // Accept close/reopening actions only if the poster is able to close the
+ // referenced issue manually at this moment. The only exception is
+ // the poster of a new PR referencing an issue on the same repo: then the merger
+ // should be responsible for checking whether the reference should resolve.
if ref.Action != references.XRefActionNone &&
ctx.Doer.ID != refIssue.PosterID &&
- !perm.CanWriteIssuesOrPulls(refIssue.IsPull) {
+ !perm.CanWriteIssuesOrPulls(refIssue.IsPull) &&
+ (refIssue.RepoID != ctx.OrigIssue.RepoID || ctx.OrigComment != nil) {
refAction = references.XRefActionNone
}
}