interpret Precedence: auto_reply as an auto reply (#7137)
Some checks failed
testing / test-pgsql (push) Has been cancelled
testing / backend-checks (push) Has been cancelled
testing / frontend-checks (push) Has been cancelled
testing / test-unit (push) Has been cancelled
testing / test-e2e (push) Has been cancelled
testing / test-remote-cacher (redis) (push) Has been cancelled
testing / test-remote-cacher (valkey) (push) Has been cancelled
testing / test-remote-cacher (garnet) (push) Has been cancelled
testing / test-remote-cacher (redict) (push) Has been cancelled
testing / test-mysql (push) Has been cancelled
testing / test-sqlite (push) Has been cancelled
testing / security-check (push) Has been cancelled
/ release (push) Has been cancelled
Integration tests for the release process / release-simulation (push) Has been cancelled

Some email clients like to be special and only set the "Precedence" header to "auto_reply" when sending automatic replies.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7137
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: christopher-besch <mail@chris-besch.com>
Co-committed-by: christopher-besch <mail@chris-besch.com>
This commit is contained in:
christopher-besch 2025-03-06 12:49:24 +00:00 committed by Otto
parent 932201fa23
commit fc4458bfbb
2 changed files with 10 additions and 0 deletions

View file

@ -297,6 +297,10 @@ func isAutomaticReply(env *enmime.Envelope) bool {
if autoReply == "yes" { if autoReply == "yes" {
return true return true
} }
precedence := env.GetHeader("Precedence")
if precedence == "auto_reply" {
return true
}
autoRespond := env.GetHeader("X-Autorespond") autoRespond := env.GetHeader("X-Autorespond")
return autoRespond != "" return autoRespond != ""
} }

View file

@ -65,6 +65,12 @@ func TestIsAutomaticReply(t *testing.T) {
}, },
Expected: true, Expected: true,
}, },
{
Headers: map[string]string{
"Precedence": "auto_reply",
},
Expected: true,
},
} }
for _, c := range cases { for _, c := range cases {