mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-31 15:26:15 -06:00
pass context to ParseNotificationTypes
This commit is contained in:
parent
0bb8e51611
commit
ece83aadcb
2 changed files with 32 additions and 27 deletions
|
|
@ -23,8 +23,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/log"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -218,28 +216,6 @@ func ParseInteractionReblogs(value string, defaultValue bool) (bool, gtserror.Wi
|
|||
return parseBool(value, defaultValue, InteractionReblogsKey)
|
||||
}
|
||||
|
||||
// ParseNotificationTypes converts the given slice of string values
|
||||
// to gtsmodel notification types, logging + skipping unknown types.
|
||||
func ParseNotificationTypes(values []string) []gtsmodel.NotificationType {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
ntypes := make([]gtsmodel.NotificationType, 0, len(values))
|
||||
for _, value := range values {
|
||||
ntype := gtsmodel.NewNotificationType(value)
|
||||
if ntype == gtsmodel.NotificationUnknown {
|
||||
// Type we don't know about (yet), log and ignore it.
|
||||
log.Debugf(nil, "ignoring unknown notification type %s", value)
|
||||
continue
|
||||
}
|
||||
|
||||
ntypes = append(ntypes, ntype)
|
||||
}
|
||||
|
||||
return ntypes
|
||||
}
|
||||
|
||||
/*
|
||||
Parse functions for *REQUIRED* parameters.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue