fix: improve IM user account search
This commit is contained in:
@@ -4077,7 +4077,7 @@ func TestServeIMUserSearch(t *testing.T) {
|
||||
oldRelations := store.Relations
|
||||
peer := types.Uid(2)
|
||||
store.Relations = &testRelationsStore{searchResults: []types.UserSearchItem{{
|
||||
User: &types.User{ObjHeader: types.ObjHeader{Id: peer.String()}, TenantID: 7, Public: map[string]any{"display_name": "Alice", "avatar_file_id": "file-1"}},
|
||||
User: &types.User{ObjHeader: types.ObjHeader{Id: peer.String()}, TenantID: 7, Public: map[string]any{"display_name": "Alice", "avatar_file_id": "file-1", "public_account": "alice001"}},
|
||||
Relationship: types.RelationshipNone,
|
||||
CanAdd: true,
|
||||
Action: "add",
|
||||
@@ -4095,7 +4095,8 @@ func TestServeIMUserSearch(t *testing.T) {
|
||||
}
|
||||
data := decodeIMHTTPResponse(t, rec).Data.(map[string]any)
|
||||
items := data["items"].([]any)
|
||||
if len(items) != 1 || items[0].(map[string]any)["relationship"] != types.RelationshipNone || items[0].(map[string]any)["can_add"] != true {
|
||||
if len(items) != 1 || items[0].(map[string]any)["relationship"] != types.RelationshipNone || items[0].(map[string]any)["can_add"] != true ||
|
||||
items[0].(map[string]any)["public_account"] != "alice001" {
|
||||
t.Fatalf("unexpected search response: %#v", data)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user