diff options
| author | 2022-09-28 17:39:32 +0200 | |
|---|---|---|
| committer | 2022-09-28 17:39:32 +0200 | |
| commit | 484a7f1fd8305ea395ae46681e17e06ac2d81565 (patch) | |
| tree | 848dee919322cdee8b53c993c53418a3cd072ebe /html.c | |
| parent | New function ftime(). (diff) | |
| download | snac2-484a7f1fd8305ea395ae46681e17e06ac2d81565.tar.gz snac2-484a7f1fd8305ea395ae46681e17e06ac2d81565.tar.xz snac2-484a7f1fd8305ea395ae46681e17e06ac2d81565.zip | |
Added the score for local posts.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 14 |
1 files changed, 13 insertions, 1 deletions
| @@ -243,7 +243,7 @@ d_char *html_user_header(snac *snac, d_char *s, int local) | |||
| 243 | s = xs_str_cat(s, "</head>\n<body>\n"); | 243 | s = xs_str_cat(s, "</head>\n<body>\n"); |
| 244 | 244 | ||
| 245 | /* top nav */ | 245 | /* top nav */ |
| 246 | s = xs_str_cat(s, "<nav style=\"snac-top-nav\">"); | 246 | s = xs_str_cat(s, "<nav class=\"snac-top-nav\">"); |
| 247 | 247 | ||
| 248 | { | 248 | { |
| 249 | xs *s1; | 249 | xs *s1; |
| @@ -390,6 +390,18 @@ d_char *html_entry(snac *snac, d_char *s, char *msg, xs_set *seen, int level) | |||
| 390 | if (!valid_status(actor_get(snac, actor, &actor_o))) | 390 | if (!valid_status(actor_get(snac, actor, &actor_o))) |
| 391 | return s; | 391 | return s; |
| 392 | 392 | ||
| 393 | /* if this is our post, add the score */ | ||
| 394 | if (xs_startswith(id, snac->actor)) { | ||
| 395 | int likes = xs_list_len(xs_dict_get(meta, "liked_by")); | ||
| 396 | int boosts = xs_list_len(xs_dict_get(meta, "announced_by")); | ||
| 397 | |||
| 398 | xs *s1 = xs_fmt( | ||
| 399 | "<div class=\"snac-score\">%d ★ %d ↺</div>\n", | ||
| 400 | likes, boosts); | ||
| 401 | |||
| 402 | s = xs_str_cat(s, s1); | ||
| 403 | } | ||
| 404 | |||
| 393 | if (level == 0) { | 405 | if (level == 0) { |
| 394 | char *referrer; | 406 | char *referrer; |
| 395 | 407 | ||