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 }}
|
||||||
|
|||||||
+1
-1
@@ -6,4 +6,4 @@
|
|||||||
|
|
||||||
{{ .timeString }}: {{ .time }}
|
{{ .timeString }}: {{ .time }}
|
||||||
|
|
||||||
{{ .notificationNotice }}
|
{{ .footer }}
|
||||||
|
|||||||
+1
-1
@@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
{{ .reasonString }}: {{ .reason }}
|
{{ .reasonString }}: {{ .reason }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
+1
-1
@@ -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
-1
@@ -1,3 +1,3 @@
|
|||||||
{{ .plaintext }}
|
{{ .plaintext }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
{{ .contactTheAdmin }}
|
{{ .contactTheAdmin }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
+1
-1
@@ -8,4 +8,4 @@
|
|||||||
|
|
||||||
{{ .yourAccountWillExpire }}
|
{{ .yourAccountWillExpire }}
|
||||||
|
|
||||||
{{ .message }}
|
{{ .footer }}
|
||||||
|
|||||||
+60
-10
@@ -345,8 +345,18 @@ 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":
|
||||||
return func(a *respUser) bool {
|
switch q.Class {
|
||||||
return cmp.Compare(strings.ToLower(a.Email), strings.ToLower(q.Value.(string))) == int(operator)
|
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":
|
case "notify_email":
|
||||||
return func(a *respUser) bool {
|
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)
|
return cmp.Compare(bool2int(a.Disabled), bool2int(q.Value.(bool))) == int(operator)
|
||||||
}
|
}
|
||||||
case "telegram":
|
case "telegram":
|
||||||
return func(a *respUser) bool {
|
switch q.Class {
|
||||||
return cmp.Compare(strings.ToLower(a.Telegram), strings.ToLower(q.Value.(string))) == int(operator)
|
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":
|
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":
|
||||||
return func(a *respUser) bool {
|
switch q.Class {
|
||||||
return cmp.Compare(strings.ToLower(a.Discord), strings.ToLower(q.Value.(string))) == int(operator)
|
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":
|
case "discord_id":
|
||||||
return func(a *respUser) bool {
|
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)
|
return cmp.Compare(bool2int(a.NotifyThroughDiscord), bool2int(q.Value.(bool))) == int(operator)
|
||||||
}
|
}
|
||||||
case "matrix":
|
case "matrix":
|
||||||
return func(a *respUser) bool {
|
switch q.Class {
|
||||||
return cmp.Compare(strings.ToLower(a.Matrix), strings.ToLower(q.Value.(string))) == int(operator)
|
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":
|
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":
|
||||||
return func(a *respUser) bool {
|
switch q.Class {
|
||||||
return cmp.Compare(strings.ToLower(a.Label), strings.ToLower(q.Value.(string))) == int(operator)
|
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":
|
case "accounts_admin":
|
||||||
return func(a *respUser) bool {
|
return func(a *respUser) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user