Revert "fix(sub): keep the client identity on every subscription link (#6098)"

This reverts commit c004c18d90.

Showing {{EMAIL}}/{{USERNAME}} on the first subscription-body link only is
intentional, not an oversight in 876d55f2. Restoring the behaviour and the
tests that pin it.

Making the identity tokens configurable is the sanctioned route for the
operators asking for them on every link (#5935), rather than flipping the
default for everyone.
This commit is contained in:
Sanaei
2026-07-27 19:43:01 +02:00
parent 8bc00d1e90
commit fd17255f1d
2 changed files with 20 additions and 18 deletions
+10 -1
View File
@@ -481,6 +481,15 @@ var connectionTokens = map[string]bool{
var displayRemoveTokens = mergeTokenSets(usageInfoTokens, connectionTokens)
// firstLinkOnlyBodyTokens are stripped from every subscription-body link after a
// client's first one: the usage/info tokens plus the per-client EMAIL/USERNAME
// identity. A client app needs the email once, so repeating it on every link of
// the same subscription is noise — show it on the first link only, like traffic.
var firstLinkOnlyBodyTokens = mergeTokenSets(usageInfoTokens, map[string]bool{
"EMAIL": true,
"USERNAME": true,
})
func mergeTokenSets(sets ...map[string]bool) map[string]bool {
out := make(map[string]bool)
for _, set := range sets {
@@ -551,7 +560,7 @@ func (s *SubService) effectiveTemplate(email string) string {
s.usageShown = map[string]bool{}
}
if s.usageShown[email] {
return filterRemarkTemplate(translated, usageInfoTokens)
return filterRemarkTemplate(translated, firstLinkOnlyBodyTokens)
}
s.usageShown[email] = true
return translated