forked from kevadesu/forgejo
services: Use proper Message-IDs for release mails
When sending notification emails about a release, use a properly formatted, RFC-compliant message id, rather than the release's HTML URL wrapped in angle brackets (which would not be compliant). Fixes #3105. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
parent
ca2473e895
commit
b0c0167c54
3 changed files with 21 additions and 2 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -36,3 +37,17 @@ func TestGenerateMessageID(t *testing.T) {
|
|||
gm = m.ToMessage()
|
||||
assert.Equal(t, "<msg-d@domain.com>", gm.GetHeader("Message-ID")[0])
|
||||
}
|
||||
|
||||
func TestGenerateMessageIDForRelease(t *testing.T) {
|
||||
setting.Domain = "localhost"
|
||||
|
||||
rel := repo_model.Release{
|
||||
ID: 42,
|
||||
Repo: &repo_model.Repository{
|
||||
OwnerName: "test",
|
||||
Name: "tag-test",
|
||||
},
|
||||
}
|
||||
m := createMessageIDForRelease(&rel)
|
||||
assert.Equal(t, "<test/tag-test/releases/42@localhost>", m)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue