Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

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

memoclaw4818bf355921
diff --git a/store/test/user_test.go b/store/test/user_test.go
index 4ee6ae15f..d9273f4fc 100644
--- a/store/test/user_test.go
+++ b/store/test/user_test.go
@@ -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()
}
diff --git a/store/user.go b/store/user.go
index 03c56acf8..ab3e0595c 100644
--- a/store/user.go
+++ b/store/user.go
@@ -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 {