mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
Skip muted morons from timelines and statuses.
This commit is contained in:
parent
b6da5b7bb3
commit
3fb91ea25a
1 changed files with 9 additions and 3 deletions
|
@ -994,6 +994,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
||||||
if (strcmp(xs_dict_get(msg, "type"), "Note") != 0)
|
if (strcmp(xs_dict_get(msg, "type"), "Note") != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* drop notes from muted morons */
|
||||||
|
if (is_muted(&snac1, xs_dict_get(msg, "attributedTo")))
|
||||||
|
continue;
|
||||||
|
|
||||||
/* convert the Note into a Mastodon status */
|
/* convert the Note into a Mastodon status */
|
||||||
xs *st = mastoapi_status(&snac1, msg);
|
xs *st = mastoapi_status(&snac1, msg);
|
||||||
|
|
||||||
|
@ -1293,7 +1297,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (xs_startswith(cmd, "/v1/statuses/")) {
|
if (xs_startswith(cmd, "/v1/statuses/")) {
|
||||||
/* operations on a status */
|
/* information about a status */
|
||||||
xs *l = xs_split(cmd, "/");
|
xs *l = xs_split(cmd, "/");
|
||||||
const char *id = xs_list_get(l, 3);
|
const char *id = xs_list_get(l, 3);
|
||||||
const char *op = xs_list_get(l, 4);
|
const char *op = xs_list_get(l, 4);
|
||||||
|
@ -1307,9 +1311,11 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
||||||
|
|
||||||
if (valid_status(timeline_get_by_md5(&snac1, id, &msg))) {
|
if (valid_status(timeline_get_by_md5(&snac1, id, &msg))) {
|
||||||
if (op == NULL) {
|
if (op == NULL) {
|
||||||
|
if (!is_muted(&snac1, xs_dict_get(msg, "attributedTo"))) {
|
||||||
/* return the status itself */
|
/* return the status itself */
|
||||||
out = mastoapi_status(&snac1, msg);
|
out = mastoapi_status(&snac1, msg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(op, "context") == 0) {
|
if (strcmp(op, "context") == 0) {
|
||||||
/* return ancestors and children */
|
/* return ancestors and children */
|
||||||
|
|
Loading…
Reference in a new issue