mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-12-25 16:53:37 +00:00
In mastoapi account search, return local users at the end.
This commit is contained in:
parent
e6eb1adc65
commit
9bc10da8a5
1 changed files with 24 additions and 24 deletions
48
mastoapi.c
48
mastoapi.c
|
@ -981,30 +981,6 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
|||
|
||||
xs_set_init(&seen);
|
||||
|
||||
/* local users */
|
||||
p = ulst;
|
||||
while (xs_list_iter(&p, &v)) {
|
||||
snac user;
|
||||
|
||||
if (strcmp(v, xs_dict_get(snac1.config, "uid")) == 0)
|
||||
continue;
|
||||
|
||||
if (user_open(&user, v)) {
|
||||
xs *v2 = xs_tolower_i(xs_dup(v));
|
||||
|
||||
if (xs_startswith(v2, q)) {
|
||||
xs *actor = msg_actor(&user);
|
||||
xs *acct = mastoapi_account(actor);
|
||||
|
||||
out = xs_list_append(out, acct);
|
||||
}
|
||||
|
||||
xs_set_add(&seen, user.actor);
|
||||
|
||||
user_free(&user);
|
||||
}
|
||||
}
|
||||
|
||||
/* user relations */
|
||||
xs_list *lsts[] = { wing, wers, NULL };
|
||||
int n;
|
||||
|
@ -1033,6 +1009,30 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
|||
}
|
||||
}
|
||||
|
||||
/* local users */
|
||||
p = ulst;
|
||||
while (xs_list_iter(&p, &v)) {
|
||||
snac user;
|
||||
|
||||
if (strcmp(v, xs_dict_get(snac1.config, "uid")) == 0)
|
||||
continue;
|
||||
|
||||
if (user_open(&user, v)) {
|
||||
xs *v2 = xs_tolower_i(xs_dup(v));
|
||||
|
||||
if (xs_startswith(v2, q)) {
|
||||
xs *actor = msg_actor(&user);
|
||||
xs *acct = mastoapi_account(actor);
|
||||
|
||||
out = xs_list_append(out, acct);
|
||||
}
|
||||
|
||||
xs_set_add(&seen, user.actor);
|
||||
|
||||
user_free(&user);
|
||||
}
|
||||
}
|
||||
|
||||
xs_set_free(&seen);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue