Unverified Commit 4818bf35 authored by memoclaw's avatar memoclaw Committed by GitHub

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

Co-authored-by: 's avatarmemoclaw <265580040+memoclaw@users.noreply.github.com>
parent 4f6730a1
...@@ -91,14 +91,6 @@ func TestUserGetByID(t *testing.T) { ...@@ -91,14 +91,6 @@ func TestUserGetByID(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.Nil(t, notFound) 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() ts.Close()
} }
......
...@@ -23,20 +23,6 @@ func (e Role) String() string { ...@@ -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 { type User struct {
ID int32 ID int32
...@@ -125,9 +111,6 @@ func (s *Store) ListUsers(ctx context.Context, find *FindUser) ([]*User, error) ...@@ -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) { func (s *Store) GetUser(ctx context.Context, find *FindUser) (*User, error) {
if find.ID != nil { if find.ID != nil {
if *find.ID == SystemBotID {
return SystemBot, nil
}
if cache, ok := s.userCache.Get(ctx, string(*find.ID)); ok { if cache, ok := s.userCache.Get(ctx, string(*find.ID)); ok {
user, ok := cache.(*User) user, ok := cache.(*User)
if ok { if ok {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment