mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
accounts: fix bool queries on (some) string fields
wasn't implemented for things like email on the server side.
also changed text mail variant's footers to all use {{ .footer }} like I
should have before.
This commit is contained in:
@@ -5,4 +5,4 @@
|
||||
|
||||
{{ .confirmationURL }}
|
||||
|
||||
{{ .message }}
|
||||
{{ .footer }}
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
|
||||
{{ .timeString }}: {{ .time }}
|
||||
|
||||
{{ .notificationNotice }}
|
||||
{{ .footer }}
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
{{ .reasonString }}: {{ .reason }}
|
||||
|
||||
{{ .message }}
|
||||
{{ .footer }}
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
{{ .expiredAt }}
|
||||
|
||||
{{ .notificationNotice }}
|
||||
{{ .footer }}
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
|
||||
{{ .reasonString }}: {{ .reason }}
|
||||
|
||||
{{ .message }}
|
||||
{{ .footer }}
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
{{ .yourAccountIsDueToExpire }}
|
||||
|
||||
{{ .message }}
|
||||
{{ .footer }}
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
|
||||
{{ .inviteURL }}
|
||||
|
||||
{{ .message }}
|
||||
{{ .footer }}
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
{{ .pinString }}: {{ .pin }}
|
||||
|
||||
{{ .message }}
|
||||
{{ .footer }}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{{ .plaintext }}
|
||||
|
||||
{{ .message }}
|
||||
{{ .footer }}
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
{{ .contactTheAdmin }}
|
||||
|
||||
{{ .message }}
|
||||
{{ .footer }}
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
|
||||
{{ .yourAccountWillExpire }}
|
||||
|
||||
{{ .message }}
|
||||
{{ .footer }}
|
||||
|
||||
70
usercache.go
70
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 {
|
||||
|
||||
Reference in New Issue
Block a user