diff options
| author | 2023-10-09 11:49:45 +0200 | |
|---|---|---|
| committer | 2023-10-09 11:49:45 +0200 | |
| commit | 1b3f768a57f42c3fab5363fc60b88912ebf649ee (patch) | |
| tree | c71a2b6eb23aa9d46991045c59f448f035050218 /data.c | |
| parent | The HTML user page does not show an error, only the empty header. (diff) | |
| download | snac2-1b3f768a57f42c3fab5363fc60b88912ebf649ee.tar.gz snac2-1b3f768a57f42c3fab5363fc60b88912ebf649ee.tar.xz snac2-1b3f768a57f42c3fab5363fc60b88912ebf649ee.zip | |
mastoapi: some tweaks to better match the returned data in timelines.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 18 |
1 files changed, 9 insertions, 9 deletions
| @@ -1121,15 +1121,6 @@ xs_list *timeline_top_level(snac *snac, xs_list *list) | |||
| 1121 | xs_list *timeline_simple_list(snac *snac, const char *idx_name, int skip, int show) | 1121 | xs_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 | |||
| 1139 | xs_list *timeline_list(snac *snac, const char *idx_name, int skip, int show) | 1130 | xs_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); |