summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar default2023-10-08 00:06:37 +0200
committerGravatar default2023-10-08 00:06:37 +0200
commit8524ace23f1ebec07fd4d51171e121b1f1e75007 (patch)
tree03f98d1ce6d29b85c31dc85e104dbfda2ff9aab8 /mastoapi.c
parentMerge branch 'master' of /home/angel/git/snac2 (diff)
downloadsnac2-8524ace23f1ebec07fd4d51171e121b1f1e75007.tar.gz
snac2-8524ace23f1ebec07fd4d51171e121b1f1e75007.tar.xz
snac2-8524ace23f1ebec07fd4d51171e121b1f1e75007.zip
Hide posts from the public web for accounts with 'private' == true.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 40ad12b..273807b 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1377,6 +1377,25 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1377 if (strcmp(type, "Note") != 0 && strcmp(type, "Question") != 0) 1377 if (strcmp(type, "Note") != 0 && strcmp(type, "Question") != 0)
1378 continue; 1378 continue;
1379 1379
1380 /* discard private users */
1381 {
1382 const char *atto = xs_dict_get(msg, "attributedTo");
1383 xs *l = xs_split(atto, "/");
1384 const char *uid = xs_list_get(l, -1);
1385 snac p_user;
1386 int skip = 1;
1387
1388 if (uid && user_open(&p_user, uid)) {
1389 if (xs_type(xs_dict_get(p_user.config, "private")) != XSTYPE_TRUE)
1390 skip = 0;
1391
1392 user_free(&p_user);
1393 }
1394
1395 if (skip)
1396 continue;
1397 }
1398
1380 /* convert the Note into a Mastodon status */ 1399 /* convert the Note into a Mastodon status */
1381 xs *st = mastoapi_status(user, msg); 1400 xs *st = mastoapi_status(user, msg);
1382 1401