diff --git a/mail/confirmation.txt b/mail/confirmation.txt index cccc813..6ea4631 100644 --- a/mail/confirmation.txt +++ b/mail/confirmation.txt @@ -5,4 +5,4 @@ {{ .confirmationURL }} -{{ .message }} +{{ .footer }} diff --git a/mail/created.txt b/mail/created.txt index 2b79071..2b16e44 100644 --- a/mail/created.txt +++ b/mail/created.txt @@ -6,4 +6,4 @@ {{ .timeString }}: {{ .time }} -{{ .notificationNotice }} +{{ .footer }} diff --git a/mail/deleted.txt b/mail/deleted.txt index e003e52..349041a 100644 --- a/mail/deleted.txt +++ b/mail/deleted.txt @@ -4,4 +4,4 @@ {{ .reasonString }}: {{ .reason }} -{{ .message }} +{{ .footer }} diff --git a/mail/expired.txt b/mail/expired.txt index 892892c..364b7a9 100644 --- a/mail/expired.txt +++ b/mail/expired.txt @@ -2,4 +2,4 @@ {{ .expiredAt }} -{{ .notificationNotice }} +{{ .footer }} diff --git a/mail/expiry-adjusted.txt b/mail/expiry-adjusted.txt index 28b5f69..4a59919 100644 --- a/mail/expiry-adjusted.txt +++ b/mail/expiry-adjusted.txt @@ -8,4 +8,4 @@ {{ .reasonString }}: {{ .reason }} -{{ .message }} +{{ .footer }} diff --git a/mail/expiry-reminder.txt b/mail/expiry-reminder.txt index 0bbae39..06d08e2 100644 --- a/mail/expiry-reminder.txt +++ b/mail/expiry-reminder.txt @@ -2,4 +2,4 @@ {{ .yourAccountIsDueToExpire }} -{{ .message }} +{{ .footer }} diff --git a/mail/invite-email.txt b/mail/invite-email.txt index c39f4c3..3aed685 100644 --- a/mail/invite-email.txt +++ b/mail/invite-email.txt @@ -5,4 +5,4 @@ {{ .inviteURL }} -{{ .message }} +{{ .footer }} diff --git a/mail/password-reset.txt b/mail/password-reset.txt index 0e4c090..ffb3eb2 100644 --- a/mail/password-reset.txt +++ b/mail/password-reset.txt @@ -10,4 +10,4 @@ {{ .pinString }}: {{ .pin }} -{{ .message }} +{{ .footer }} diff --git a/mail/template.txt b/mail/template.txt index d6af7d2..54a67cf 100644 --- a/mail/template.txt +++ b/mail/template.txt @@ -1,3 +1,3 @@ {{ .plaintext }} -{{ .message }} +{{ .footer }} diff --git a/mail/user-expired.txt b/mail/user-expired.txt index bfd2dcc..649018c 100644 --- a/mail/user-expired.txt +++ b/mail/user-expired.txt @@ -2,4 +2,4 @@ {{ .contactTheAdmin }} -{{ .message }} +{{ .footer }} diff --git a/mail/welcome.txt b/mail/welcome.txt index 9344210..190293a 100644 --- a/mail/welcome.txt +++ b/mail/welcome.txt @@ -8,4 +8,4 @@ {{ .yourAccountWillExpire }} -{{ .message }} +{{ .footer }} diff --git a/usercache.go b/usercache.go index ca5f8d5..2988fe5 100644 --- a/usercache.go +++ b/usercache.go @@ -345,8 +345,18 @@ func (q QueryDTO) AsFilter() Filter { return cmp.Compare(strings.ToLower(a.Name), strings.ToLower(q.Value.(string))) == int(operator) } case "email": - return func(a *respUser) bool { - return cmp.Compare(strings.ToLower(a.Email), strings.ToLower(q.Value.(string))) == int(operator) + switch q.Class { + case BoolQuery: + return func(a *respUser) bool { + if q.Value.(bool) { + return a.Email != "" + } + return a.Email == "" + } + case StringQuery: + return func(a *respUser) bool { + return cmp.Compare(strings.ToLower(a.Email), strings.ToLower(q.Value.(string))) == int(operator) + } } case "notify_email": return func(a *respUser) bool { @@ -391,16 +401,36 @@ func (q QueryDTO) AsFilter() Filter { return cmp.Compare(bool2int(a.Disabled), bool2int(q.Value.(bool))) == int(operator) } case "telegram": - return func(a *respUser) bool { - return cmp.Compare(strings.ToLower(a.Telegram), strings.ToLower(q.Value.(string))) == int(operator) + switch q.Class { + case BoolQuery: + return func(a *respUser) bool { + if q.Value.(bool) { + return a.Telegram != "" + } + return a.Telegram == "" + } + case StringQuery: + return func(a *respUser) bool { + return cmp.Compare(strings.ToLower(a.Telegram), strings.ToLower(q.Value.(string))) == int(operator) + } } case "notify_telegram": return func(a *respUser) bool { return cmp.Compare(bool2int(a.NotifyThroughTelegram), bool2int(q.Value.(bool))) == int(operator) } case "discord": - return func(a *respUser) bool { - return cmp.Compare(strings.ToLower(a.Discord), strings.ToLower(q.Value.(string))) == int(operator) + switch q.Class { + case BoolQuery: + return func(a *respUser) bool { + if q.Value.(bool) { + return a.Discord != "" + } + return a.Discord == "" + } + case StringQuery: + return func(a *respUser) bool { + return cmp.Compare(strings.ToLower(a.Discord), strings.ToLower(q.Value.(string))) == int(operator) + } } case "discord_id": return func(a *respUser) bool { @@ -411,16 +441,36 @@ func (q QueryDTO) AsFilter() Filter { return cmp.Compare(bool2int(a.NotifyThroughDiscord), bool2int(q.Value.(bool))) == int(operator) } case "matrix": - return func(a *respUser) bool { - return cmp.Compare(strings.ToLower(a.Matrix), strings.ToLower(q.Value.(string))) == int(operator) + switch q.Class { + case BoolQuery: + return func(a *respUser) bool { + if q.Value.(bool) { + return a.Matrix != "" + } + return a.Matrix == "" + } + case StringQuery: + return func(a *respUser) bool { + return cmp.Compare(strings.ToLower(a.Matrix), strings.ToLower(q.Value.(string))) == int(operator) + } } case "notify_matrix": return func(a *respUser) bool { return cmp.Compare(bool2int(a.NotifyThroughMatrix), bool2int(q.Value.(bool))) == int(operator) } case "label": - return func(a *respUser) bool { - return cmp.Compare(strings.ToLower(a.Label), strings.ToLower(q.Value.(string))) == int(operator) + switch q.Class { + case BoolQuery: + return func(a *respUser) bool { + if q.Value.(bool) { + return a.Label != "" + } + return a.Label == "" + } + case StringQuery: + return func(a *respUser) bool { + return cmp.Compare(strings.ToLower(a.Label), strings.ToLower(q.Value.(string))) == int(operator) + } } case "accounts_admin": return func(a *respUser) bool {