summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-05-11 19:35:33 +0200
committerdefault <nobody@localhost>2024-05-11 19:35:33 +0200
commit9acba489fb37f0d3daca45aad17df96a6360efe5 (patch)
treecea4f31cae0396f9ac61acfddf89d33832f1a4d8
parent0a11d70fbecd69e0c93000581b800ff434d42767 (diff)
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)
s = xs_str_cat(s, s2);
} else {
+ /* treat end of divs as paragraph breaks */
if (strcmp(v, "</div>"))
s = xs_str_cat(s, "<p>");
}
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,
char *type = xs_dict_get(msg, "type");
char *actor;
char *v;
+ int has_title = 0;
/* do not show non-public messages in the public timeline */
if ((read_only || !user) && !is_msg_public(msg))
@@ -1484,6 +1485,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
}
}
+ if (strcmp(type, "Event") == 0) {
+ /* add the calendar emoji */
+ xs_html_add(score,
+ xs_html_tag("span",
+ xs_html_attr("title", L("Event")),
+ xs_html_raw(" &#128197; ")));
+ }
+
/* if it's a user from this same instance, add the score */
if (xs_startswith(id, srv_baseurl)) {
int n_likes = object_likes_len(id);
@@ -1575,11 +1584,13 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
xs_html_add(entry,
snac_content_wrap);
- if (!xs_is_null(v = xs_dict_get(msg, "name"))) {
+ if (!has_title && !xs_is_null(v = xs_dict_get(msg, "name"))) {
xs_html_add(snac_content_wrap,
xs_html_tag("h3",
xs_html_attr("class", "snac-entry-title"),
xs_html_text(v)));
+
+ has_title = 1;
}
xs_html *snac_content = NULL;
@@ -1604,12 +1615,15 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
}
else {
/* print the summary as a header (sites like e.g. Friendica can contain one) */
- if (!xs_is_null(v) && *v)
+ if (!has_title && !xs_is_null(v) && *v) {
xs_html_add(snac_content_wrap,
xs_html_tag("h3",
xs_html_attr("class", "snac-entry-title"),
xs_html_text(v)));
+ has_title = 1;
+ }
+
snac_content = xs_html_tag("div", NULL);
}