refactor(store): remove synthetic system bot user lookup (#5778)

Co-authored-by: memoclaw <265580040+memoclaw@users.noreply.github.com>
pull/5781/head
memoclaw 2 months ago committed by GitHub
parent 4f6730a12e
commit 4818bf3559
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -91,14 +91,6 @@ func TestUserGetByID(t *testing.T) {
require.NoError(t, err)
require.Nil(t, notFound)
// Get system bot
systemBotID := store.SystemBotID
systemBot, err := ts.GetUser(ctx, &store.FindUser{ID: &systemBotID})
require.NoError(t, err)
require.NotNil(t, systemBot)
require.Equal(t, store.SystemBotID, systemBot.ID)
require.Equal(t, "system_bot", systemBot.Username)
ts.Close()
}

@ -23,20 +23,6 @@ func (e Role) String() string {
}
}
const (
SystemBotID int32 = 0
)
var (
SystemBot = &User{
ID: SystemBotID,
Username: "system_bot",
Role: RoleAdmin,
Email: "",
Nickname: "Bot",
}
)
type User struct {
ID int32
@ -125,9 +111,6 @@ func (s *Store) ListUsers(ctx context.Context, find *FindUser) ([]*User, error)
func (s *Store) GetUser(ctx context.Context, find *FindUser) (*User, error) {
if find.ID != nil {
if *find.ID == SystemBotID {
return SystemBot, nil
}
if cache, ok := s.userCache.Get(ctx, string(*find.ID)); ok {
user, ok := cache.(*User)
if ok {

Loading…
Cancel
Save