:generics-intensifies:
This commit is contained in:
parent
d7fa51be2c
commit
5f37741fe3
11 changed files with 38 additions and 44 deletions
|
@ -918,7 +918,7 @@ func (s *Server) topicsFromIDs(ids ...string) ([]*topic, error) {
|
|||
defer s.mu.Unlock()
|
||||
topics := make([]*topic, 0)
|
||||
for _, id := range ids {
|
||||
if util.InStringList(disallowedTopics, id) {
|
||||
if util.Contains(disallowedTopics, id) {
|
||||
return nil, errHTTPBadRequestTopicDisallowed
|
||||
}
|
||||
if _, ok := s.topics[id]; !ok {
|
||||
|
@ -1086,7 +1086,7 @@ func (s *Server) sendDelayedMessages() error {
|
|||
|
||||
func (s *Server) limitRequests(next handleFunc) handleFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request, v *visitor) error {
|
||||
if util.InStringList(s.config.VisitorRequestExemptIPAddrs, v.ip) {
|
||||
if util.Contains(s.config.VisitorRequestExemptIPAddrs, v.ip) {
|
||||
return next(w, r, v)
|
||||
} else if err := v.RequestAllowed(); err != nil {
|
||||
return errHTTPTooManyRequestsLimitRequests
|
||||
|
|
|
@ -108,7 +108,7 @@ func toEmojis(tags []string) (emojisOut []string, tagsOut []string, err error) {
|
|||
nextTag:
|
||||
for _, t := range tags { // TODO Super inefficient; we should just create a .json file with a map
|
||||
for _, e := range emojis {
|
||||
if util.InStringList(e.Aliases, t) {
|
||||
if util.Contains(e.Aliases, t) {
|
||||
emojisOut = append(emojisOut, e.Emoji)
|
||||
continue nextTag
|
||||
}
|
||||
|
|
|
@ -169,10 +169,10 @@ func (q *queryFilter) Pass(msg *message) bool {
|
|||
if messagePriority == 0 {
|
||||
messagePriority = 3 // For query filters, default priority (3) is the same as "not set" (0)
|
||||
}
|
||||
if len(q.Priority) > 0 && !util.InIntList(q.Priority, messagePriority) {
|
||||
if len(q.Priority) > 0 && !util.Contains(q.Priority, messagePriority) {
|
||||
return false
|
||||
}
|
||||
if len(q.Tags) > 0 && !util.InStringListAll(msg.Tags, q.Tags) {
|
||||
if len(q.Tags) > 0 && !util.ContainsAll(msg.Tags, q.Tags) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue