Skip to content

Commit

Permalink
fix: type assertion in revoke command
Browse files Browse the repository at this point in the history
  • Loading branch information
muety committed Mar 6, 2022
1 parent 5610f03 commit 492e5ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions services/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package services

import (
"fmt"
"github.com/muety/telepush/config"
"github.com/muety/telepush/model"
"github.com/muety/telepush/store"
"strconv"
Expand All @@ -14,10 +13,6 @@ type UserService struct {

type Tokens []string

var protectedKeys = map[string]bool{
config.KeyUpdateID: true,
}

func (tokens Tokens) String() string {
var str string
for i, t := range tokens {
Expand Down Expand Up @@ -50,11 +45,10 @@ func (s *UserService) ResolveToken(token string) string {
func (s *UserService) ListTokens(chatId int) Tokens {
tokens := make(Tokens, 0)
for k, v := range s.store.GetItems() {
if _, ok := protectedKeys[k]; ok {
continue
}
if v.(model.StoreObject).ChatId == chatId {
tokens = append(tokens, k)
if obj, ok := v.(model.StoreObject); ok {
if obj.ChatId == chatId {
tokens = append(tokens, k)
}
}
}
return tokens
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.1.1

0 comments on commit 492e5ce

Please sign in to comment.