mirror of
https://github.com/usememos/memos.git
synced 2024-12-26 23:22:47 +08:00
chore: fix workspace profile api
This commit is contained in:
parent
16cfef32d6
commit
2ebea4dba9
1 changed files with 6 additions and 6 deletions
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/usememos/memos/store"
|
"github.com/usememos/memos/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
var owner *apiv2pb.User
|
var ownerCache *apiv2pb.User
|
||||||
|
|
||||||
func (s *APIV2Service) GetWorkspaceProfile(ctx context.Context, _ *apiv2pb.GetWorkspaceProfileRequest) (*apiv2pb.GetWorkspaceProfileResponse, error) {
|
func (s *APIV2Service) GetWorkspaceProfile(ctx context.Context, _ *apiv2pb.GetWorkspaceProfileRequest) (*apiv2pb.GetWorkspaceProfileResponse, error) {
|
||||||
workspaceProfile := &apiv2pb.WorkspaceProfile{
|
workspaceProfile := &apiv2pb.WorkspaceProfile{
|
||||||
|
@ -39,8 +39,8 @@ func (s *APIV2Service) GetWorkspaceProfile(ctx context.Context, _ *apiv2pb.GetWo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *APIV2Service) GetInstanceOwner(ctx context.Context) (*apiv2pb.User, error) {
|
func (s *APIV2Service) GetInstanceOwner(ctx context.Context) (*apiv2pb.User, error) {
|
||||||
if owner != nil {
|
if ownerCache != nil {
|
||||||
return owner, nil
|
return ownerCache, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
hostUserType := store.RoleHost
|
hostUserType := store.RoleHost
|
||||||
|
@ -51,9 +51,9 @@ func (s *APIV2Service) GetInstanceOwner(ctx context.Context) (*apiv2pb.User, err
|
||||||
return nil, errors.Wrapf(err, "failed to find owner")
|
return nil, errors.Wrapf(err, "failed to find owner")
|
||||||
}
|
}
|
||||||
if user == nil {
|
if user == nil {
|
||||||
return nil, errors.New("owner not found")
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
owner = convertUserFromStore(user)
|
ownerCache = convertUserFromStore(user)
|
||||||
return owner, nil
|
return ownerCache, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue