mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-03-18 21:50:33 +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 }}
|
{{ .confirmationURL }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
|
|
||||||
{{ .timeString }}: {{ .time }}
|
{{ .timeString }}: {{ .time }}
|
||||||
|
|
||||||
{{ .notificationNotice }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
{{ .reasonString }}: {{ .reason }}
|
{{ .reasonString }}: {{ .reason }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
{{ .expiredAt }}
|
{{ .expiredAt }}
|
||||||
|
|
||||||
{{ .notificationNotice }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -8,4 +8,4 @@
|
|||||||
|
|
||||||
{{ .reasonString }}: {{ .reason }}
|
{{ .reasonString }}: {{ .reason }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
{{ .yourAccountIsDueToExpire }}
|
{{ .yourAccountIsDueToExpire }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -5,4 +5,4 @@
|
|||||||
|
|
||||||
{{ .inviteURL }}
|
{{ .inviteURL }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -10,4 +10,4 @@
|
|||||||
|
|
||||||
{{ .pinString }}: {{ .pin }}
|
{{ .pinString }}: {{ .pin }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{{ .plaintext }}
|
{{ .plaintext }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
{{ .contactTheAdmin }}
|
{{ .contactTheAdmin }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -8,4 +8,4 @@
|
|||||||
|
|
||||||
{{ .yourAccountWillExpire }}
|
{{ .yourAccountWillExpire }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
50
usercache.go
50
usercache.go
@@ -345,9 +345,19 @@ func (q QueryDTO) AsFilter() Filter {
|
|||||||
return cmp.Compare(strings.ToLower(a.Name), strings.ToLower(q.Value.(string))) == int(operator)
|
return cmp.Compare(strings.ToLower(a.Name), strings.ToLower(q.Value.(string))) == int(operator)
|
||||||
}
|
}
|
||||||
case "email":
|
case "email":
|
||||||
|
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 func(a *respUser) bool {
|
||||||
return cmp.Compare(strings.ToLower(a.Email), strings.ToLower(q.Value.(string))) == int(operator)
|
return cmp.Compare(strings.ToLower(a.Email), strings.ToLower(q.Value.(string))) == int(operator)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case "notify_email":
|
case "notify_email":
|
||||||
return func(a *respUser) bool {
|
return func(a *respUser) bool {
|
||||||
return cmp.Compare(bool2int(a.NotifyThroughEmail), bool2int(q.Value.(bool))) == int(operator)
|
return cmp.Compare(bool2int(a.NotifyThroughEmail), bool2int(q.Value.(bool))) == int(operator)
|
||||||
@@ -391,17 +401,37 @@ func (q QueryDTO) AsFilter() Filter {
|
|||||||
return cmp.Compare(bool2int(a.Disabled), bool2int(q.Value.(bool))) == int(operator)
|
return cmp.Compare(bool2int(a.Disabled), bool2int(q.Value.(bool))) == int(operator)
|
||||||
}
|
}
|
||||||
case "telegram":
|
case "telegram":
|
||||||
|
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 func(a *respUser) bool {
|
||||||
return cmp.Compare(strings.ToLower(a.Telegram), strings.ToLower(q.Value.(string))) == int(operator)
|
return cmp.Compare(strings.ToLower(a.Telegram), strings.ToLower(q.Value.(string))) == int(operator)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case "notify_telegram":
|
case "notify_telegram":
|
||||||
return func(a *respUser) bool {
|
return func(a *respUser) bool {
|
||||||
return cmp.Compare(bool2int(a.NotifyThroughTelegram), bool2int(q.Value.(bool))) == int(operator)
|
return cmp.Compare(bool2int(a.NotifyThroughTelegram), bool2int(q.Value.(bool))) == int(operator)
|
||||||
}
|
}
|
||||||
case "discord":
|
case "discord":
|
||||||
|
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 func(a *respUser) bool {
|
||||||
return cmp.Compare(strings.ToLower(a.Discord), strings.ToLower(q.Value.(string))) == int(operator)
|
return cmp.Compare(strings.ToLower(a.Discord), strings.ToLower(q.Value.(string))) == int(operator)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case "discord_id":
|
case "discord_id":
|
||||||
return func(a *respUser) bool {
|
return func(a *respUser) bool {
|
||||||
return cmp.Compare(strings.ToLower(a.DiscordID), strings.ToLower(q.Value.(string))) == int(operator)
|
return cmp.Compare(strings.ToLower(a.DiscordID), strings.ToLower(q.Value.(string))) == int(operator)
|
||||||
@@ -411,17 +441,37 @@ func (q QueryDTO) AsFilter() Filter {
|
|||||||
return cmp.Compare(bool2int(a.NotifyThroughDiscord), bool2int(q.Value.(bool))) == int(operator)
|
return cmp.Compare(bool2int(a.NotifyThroughDiscord), bool2int(q.Value.(bool))) == int(operator)
|
||||||
}
|
}
|
||||||
case "matrix":
|
case "matrix":
|
||||||
|
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 func(a *respUser) bool {
|
||||||
return cmp.Compare(strings.ToLower(a.Matrix), strings.ToLower(q.Value.(string))) == int(operator)
|
return cmp.Compare(strings.ToLower(a.Matrix), strings.ToLower(q.Value.(string))) == int(operator)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case "notify_matrix":
|
case "notify_matrix":
|
||||||
return func(a *respUser) bool {
|
return func(a *respUser) bool {
|
||||||
return cmp.Compare(bool2int(a.NotifyThroughMatrix), bool2int(q.Value.(bool))) == int(operator)
|
return cmp.Compare(bool2int(a.NotifyThroughMatrix), bool2int(q.Value.(bool))) == int(operator)
|
||||||
}
|
}
|
||||||
case "label":
|
case "label":
|
||||||
|
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 func(a *respUser) bool {
|
||||||
return cmp.Compare(strings.ToLower(a.Label), strings.ToLower(q.Value.(string))) == int(operator)
|
return cmp.Compare(strings.ToLower(a.Label), strings.ToLower(q.Value.(string))) == int(operator)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case "accounts_admin":
|
case "accounts_admin":
|
||||||
return func(a *respUser) bool {
|
return func(a *respUser) bool {
|
||||||
return cmp.Compare(bool2int(a.AccountsAdmin), bool2int(q.Value.(bool))) == int(operator)
|
return cmp.Compare(bool2int(a.AccountsAdmin), bool2int(q.Value.(bool))) == int(operator)
|
||||||
|
|||||||
Reference in New Issue
Block a user