feat: assign IM user account numbers
This commit is contained in:
@@ -95,22 +95,23 @@ func TestGroupMessageQuerySupportsOperationalFilters(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUserQuerySupportsKeywordAndUserIDs(t *testing.T) {
|
||||
req := httptest.NewRequest("GET", "/?keyword=alice&user_ids=101,202", nil)
|
||||
req := httptest.NewRequest("GET", "/?keyword=alice&user_ids=101,202&account_no=1000", nil)
|
||||
query, countQuery, args, _, _, err := buildInternalAdminListQuery(req, usersInternalQuerySpec(), "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, clause := range []string{"CONCAT_WS(' ',u.username,p.nickname,u.phone) LIKE ?", "u.id IN (?,?)"} {
|
||||
for _, clause := range []string{"CONCAT_WS(' ',u.username,p.nickname,u.phone,CAST(u.account_no AS CHAR)) LIKE ?", "u.id IN (?,?)", "u.account_no = ?"} {
|
||||
if !strings.Contains(query, clause) || !strings.Contains(countQuery, clause) {
|
||||
t.Fatalf("user query missing %q: %s", clause, query)
|
||||
}
|
||||
}
|
||||
want := []any{int64(101), int64(202), "%alice%"}
|
||||
want := []any{int64(101), int64(202), int64(1000), "%alice%"}
|
||||
if !reflect.DeepEqual(args, want) {
|
||||
t.Fatalf("unexpected filter arguments: got %#v, want %#v", args, want)
|
||||
}
|
||||
for _, field := range []string{
|
||||
"AS avatar",
|
||||
"u.account_no AS display_no",
|
||||
"AS register_type",
|
||||
"im_registration_invite_uses",
|
||||
"im_fileuploads AS avatar",
|
||||
|
||||
Reference in New Issue
Block a user