summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-05-17 07:27:08 +0200
committerdefault <nobody@localhost>2023-05-17 07:27:08 +0200
commit9bc10da8a5e49fceaeb8a6c37afe2d3cac0b398e (patch)
tree95d14eca556545c4e0357b6ddf4780107cd37330 /mastoapi.c
parente6eb1adc65cd9fcd315fa8d2e630717b216e9a93 (diff)
In mastoapi account search, return local users at the end.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 047e4bd..3403f53 100644
--- a/mastoapi.c
+++ b/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);
}
}