summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2024-05-11 19:35:33 +0200
committerGravatar default2024-05-11 19:35:33 +0200
commit9acba489fb37f0d3daca45aad17df96a6360efe5 (patch)
treecea4f31cae0396f9ac61acfddf89d33832f1a4d8
parentFixed git conflict. (diff)
downloadpenes-snac2-9acba489fb37f0d3daca45aad17df96a6360efe5.tar.gz
penes-snac2-9acba489fb37f0d3daca45aad17df96a6360efe5.tar.xz
penes-snac2-9acba489fb37f0d3daca45aad17df96a6360efe5.zip
Add some special treatment to Event object display.
-rw-r--r--format.c1
-rw-r--r--html.c18
2 files changed, 17 insertions, 2 deletions
diff --git a/format.c b/format.c
index 631c11c..df3b5d9 100644
--- a/format.c
+++ b/format.c
@@ -311,6 +311,7 @@ xs_str *sanitize(const char *content)
311 311
312 s = xs_str_cat(s, s2); 312 s = xs_str_cat(s, s2);
313 } else { 313 } else {
314 /* treat end of divs as paragraph breaks */
314 if (strcmp(v, "</div>")) 315 if (strcmp(v, "</div>"))
315 s = xs_str_cat(s, "<p>"); 316 s = xs_str_cat(s, "<p>");
316 } 317 }
diff --git a/html.c b/html.c
index 201456e..10b1427 100644
--- a/html.c
+++ b/html.c
@@ -1374,6 +1374,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
1374 char *type = xs_dict_get(msg, "type"); 1374 char *type = xs_dict_get(msg, "type");
1375 char *actor; 1375 char *actor;
1376 char *v; 1376 char *v;
1377 int has_title = 0;
1377 1378
1378 /* do not show non-public messages in the public timeline */ 1379 /* do not show non-public messages in the public timeline */
1379 if ((read_only || !user) && !is_msg_public(msg)) 1380 if ((read_only || !user) && !is_msg_public(msg))
@@ -1484,6 +1485,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
1484 } 1485 }
1485 } 1486 }
1486 1487
1488 if (strcmp(type, "Event") == 0) {
1489 /* add the calendar emoji */
1490 xs_html_add(score,
1491 xs_html_tag("span",
1492 xs_html_attr("title", L("Event")),
1493 xs_html_raw(" &#128197; ")));
1494 }
1495
1487 /* if it's a user from this same instance, add the score */ 1496 /* if it's a user from this same instance, add the score */
1488 if (xs_startswith(id, srv_baseurl)) { 1497 if (xs_startswith(id, srv_baseurl)) {
1489 int n_likes = object_likes_len(id); 1498 int n_likes = object_likes_len(id);
@@ -1575,11 +1584,13 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
1575 xs_html_add(entry, 1584 xs_html_add(entry,
1576 snac_content_wrap); 1585 snac_content_wrap);
1577 1586
1578 if (!xs_is_null(v = xs_dict_get(msg, "name"))) { 1587 if (!has_title && !xs_is_null(v = xs_dict_get(msg, "name"))) {
1579 xs_html_add(snac_content_wrap, 1588 xs_html_add(snac_content_wrap,
1580 xs_html_tag("h3", 1589 xs_html_tag("h3",
1581 xs_html_attr("class", "snac-entry-title"), 1590 xs_html_attr("class", "snac-entry-title"),
1582 xs_html_text(v))); 1591 xs_html_text(v)));
1592
1593 has_title = 1;
1583 } 1594 }
1584 1595
1585 xs_html *snac_content = NULL; 1596 xs_html *snac_content = NULL;
@@ -1604,12 +1615,15 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
1604 } 1615 }
1605 else { 1616 else {
1606 /* print the summary as a header (sites like e.g. Friendica can contain one) */ 1617 /* print the summary as a header (sites like e.g. Friendica can contain one) */
1607 if (!xs_is_null(v) && *v) 1618 if (!has_title && !xs_is_null(v) && *v) {
1608 xs_html_add(snac_content_wrap, 1619 xs_html_add(snac_content_wrap,
1609 xs_html_tag("h3", 1620 xs_html_tag("h3",
1610 xs_html_attr("class", "snac-entry-title"), 1621 xs_html_attr("class", "snac-entry-title"),
1611 xs_html_text(v))); 1622 xs_html_text(v)));
1612 1623
1624 has_title = 1;
1625 }
1626
1613 snac_content = xs_html_tag("div", NULL); 1627 snac_content = xs_html_tag("div", NULL);
1614 } 1628 }
1615 1629