summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-10-09 11:49:45 +0200
committerGravatar default2023-10-09 11:49:45 +0200
commit1b3f768a57f42c3fab5363fc60b88912ebf649ee (patch)
treec71a2b6eb23aa9d46991045c59f448f035050218
parentThe HTML user page does not show an error, only the empty header. (diff)
downloadsnac2-1b3f768a57f42c3fab5363fc60b88912ebf649ee.tar.gz
snac2-1b3f768a57f42c3fab5363fc60b88912ebf649ee.tar.xz
snac2-1b3f768a57f42c3fab5363fc60b88912ebf649ee.zip
mastoapi: some tweaks to better match the returned data in timelines.
-rw-r--r--data.c18
-rw-r--r--mastoapi.c23
2 files changed, 23 insertions, 18 deletions
diff --git a/data.c b/data.c
index cf4d39b..02e5234 100644
--- a/data.c
+++ b/data.c
@@ -1121,15 +1121,6 @@ xs_list *timeline_top_level(snac *snac, xs_list *list)
1121xs_list *timeline_simple_list(snac *snac, const char *idx_name, int skip, int show) 1121xs_list *timeline_simple_list(snac *snac, const char *idx_name, int skip, int show)
1122/* returns a timeline (with all entries) */ 1122/* returns a timeline (with all entries) */
1123{ 1123{
1124 int c_max;
1125
1126 /* maximum number of items in the timeline */
1127 c_max = xs_number_get(xs_dict_get(srv_config, "max_timeline_entries"));
1128
1129 /* never more timeline entries than the configured maximum */
1130 if (show > c_max)
1131 show = c_max;
1132
1133 xs *idx = xs_fmt("%s/%s.idx", snac->basedir, idx_name); 1124 xs *idx = xs_fmt("%s/%s.idx", snac->basedir, idx_name);
1134 1125
1135 return index_list_desc(idx, skip, show); 1126 return index_list_desc(idx, skip, show);
@@ -1139,6 +1130,15 @@ xs_list *timeline_simple_list(snac *snac, const char *idx_name, int skip, int sh
1139xs_list *timeline_list(snac *snac, const char *idx_name, int skip, int show) 1130xs_list *timeline_list(snac *snac, const char *idx_name, int skip, int show)
1140/* returns a timeline (only top level entries) */ 1131/* returns a timeline (only top level entries) */
1141{ 1132{
1133 int c_max;
1134
1135 /* maximum number of items in the timeline */
1136 c_max = xs_number_get(xs_dict_get(srv_config, "max_timeline_entries"));
1137
1138 /* never more timeline entries than the configured maximum */
1139 if (show > c_max)
1140 show = c_max;
1141
1142 xs *list = timeline_simple_list(snac, idx_name, skip, show); 1142 xs *list = timeline_simple_list(snac, idx_name, skip, show);
1143 1143
1144 return timeline_top_level(snac, list); 1144 return timeline_top_level(snac, list);
diff --git a/mastoapi.c b/mastoapi.c
index 273807b..3473781 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1265,7 +1265,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1265 if (limit == 0) 1265 if (limit == 0)
1266 limit = 20; 1266 limit = 20;
1267 1267
1268 xs *timeline = timeline_simple_list(&snac1, "private", 0, 256); 1268 xs *timeline = timeline_simple_list(&snac1, "private", 0, 2048);
1269 1269
1270 xs *out = xs_list_new(); 1270 xs *out = xs_list_new();
1271 xs_list *p = timeline; 1271 xs_list *p = timeline;
@@ -1304,19 +1304,24 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1304 if (strcmp(type, "Note") != 0 && strcmp(type, "Question") != 0) 1304 if (strcmp(type, "Note") != 0 && strcmp(type, "Question") != 0)
1305 continue; 1305 continue;
1306 1306
1307#if 0 1307 const char *atto = xs_dict_get(msg, "attributedTo");
1308 /* discard notes from people we don't follow with no boosts */ 1308 const char *id = xs_dict_get(msg, "id");
1309 if (!following_check(&snac1, xs_dict_get(msg, "attributedTo")) && 1309
1310 object_announces_len(xs_dict_get(msg, "id")) == 0) 1310 /* is this message from a person we don't follow? */
1311 continue; 1311 if (strcmp(atto, snac1.actor) && !following_check(&snac1, atto)) {
1312#endif 1312 /* if we didn't boost it, discard */
1313 xs *idx = object_announces(id);
1314
1315 if (xs_list_in(idx, snac1.md5) == -1)
1316 continue;
1317 }
1313 1318
1314 /* discard notes from muted morons */ 1319 /* discard notes from muted morons */
1315 if (is_muted(&snac1, xs_dict_get(msg, "attributedTo"))) 1320 if (is_muted(&snac1, atto))
1316 continue; 1321 continue;
1317 1322
1318 /* discard hidden notes */ 1323 /* discard hidden notes */
1319 if (is_hidden(&snac1, xs_dict_get(msg, "id"))) 1324 if (is_hidden(&snac1, id))
1320 continue; 1325 continue;
1321 1326
1322 /* discard poll votes (they have a name) */ 1327 /* discard poll votes (they have a name) */