🐛 Fix list user relative return wrong data
This commit is contained in:
parent
573ccc0478
commit
afc2ec80e9
8
.idea/workspace.xml
generated
8
.idea/workspace.xml
generated
@ -4,9 +4,9 @@
|
||||
<option name="autoReloadType" value="ALL" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":zap: A separate API to only get notification count">
|
||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Bug fixes on notifications">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/http/api/notifications_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/http/api/notifications_api.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/grpc/user.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/grpc/user.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -159,7 +159,6 @@
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<MESSAGE value=":sparkles: Support jwks.json according OIDC stranded" />
|
||||
<MESSAGE value=":bug: Fix get user grpc method didn't extend group's permission" />
|
||||
<MESSAGE value=":bug: Fix unable get user full perm node" />
|
||||
<MESSAGE value=":loud_sound: Add verbose permission logging" />
|
||||
@ -184,7 +183,8 @@
|
||||
<MESSAGE value=":zap: Add cache into querying user" />
|
||||
<MESSAGE value=":bug: Fix missing api endpoint" />
|
||||
<MESSAGE value=":zap: A separate API to only get notification count" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":zap: A separate API to only get notification count" />
|
||||
<MESSAGE value=":bug: Bug fixes on notifications" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Bug fixes on notifications" />
|
||||
<option name="GROUP_MULTIFILE_MERGE_BY_DIRECTORY" value="true" />
|
||||
</component>
|
||||
<component name="VgoProject">
|
||||
|
@ -91,7 +91,7 @@ func (v *App) ListUser(ctx context.Context, request *proto.ListUserRequest) (*pr
|
||||
}
|
||||
|
||||
func (v *App) ListUserRelative(ctx context.Context, request *proto.ListUserRelativeRequest) (*proto.ListUserRelativeResponse, error) {
|
||||
tx := database.C.Preload("Account").Where("status = ?", request.GetStatus())
|
||||
tx := database.C.Preload("Account").Preload("Related").Where("status = ?", request.GetStatus())
|
||||
|
||||
if request.GetIsRelated() {
|
||||
tx = tx.Where("related_id = ?", request.GetUserId())
|
||||
@ -106,9 +106,10 @@ func (v *App) ListUserRelative(ctx context.Context, request *proto.ListUserRelat
|
||||
|
||||
return &proto.ListUserRelativeResponse{
|
||||
Data: lo.Map(data, func(item models.AccountRelationship, index int) *proto.UserInfo {
|
||||
account := lo.Ternary(request.GetIsRelated(), item.Account, item.Related)
|
||||
val := &proto.UserInfo{
|
||||
Id: uint64(item.AccountID),
|
||||
Name: item.Account.Name,
|
||||
Id: uint64(account.ID),
|
||||
Name: account.Name,
|
||||
}
|
||||
|
||||
return val
|
||||
|
Loading…
Reference in New Issue
Block a user