]> source.dussan.org Git - gitea.git/commitdiff
Allow authors to use act keywords in PR content (#9059)
authorguillep2k <18600385+guillep2k@users.noreply.github.com>
Mon, 18 Nov 2019 17:03:49 +0000 (14:03 -0300)
committerLauris BH <lauris@nix.lv>
Mon, 18 Nov 2019 17:03:49 +0000 (19:03 +0200)
models/issue_xref.go

index 41937dc675336c678fcc77272b41debdf2d7b0e7..f41c154753068ddfeaa28d83034057ad02a7ce44 100644 (file)
@@ -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
                }
        }