commit 9be8016

default  ·  2024-06-18 04:07:58 +0000 UTC
parent 534cf2c
Don't show the instance announcement in public pages.
1 files changed,  +18, -16
M html.c
M html.c
+18, -16
 1@@ -788,22 +788,24 @@ static xs_html *html_user_body(snac *user, int read_only)
 2 
 3     /** instance announcement **/
 4 
 5-    double la = 0.0;
 6-    xs *user_la = xs_dup(xs_dict_get(user->config, "last_announcement"));
 7-    if (user_la != NULL)
 8-        la = xs_number_get(user_la);
 9-
10-    const t_announcement *an = announcement(la);
11-    if (an != NULL && (an->text != NULL)) {
12-        xs *s = xs_fmt("?da=%.0f", an->timestamp);
13-
14-        xs_html_add(top_user,  xs_html_tag("div",
15-            xs_html_attr("class", "snac-announcement"),
16-                xs_html_text(an->text),
17-                xs_html_text(" "),
18-                xs_html_tag("a",
19-                        xs_html_attr("href", s),
20-                        xs_html_text("Dismiss"))));
21+    if (!read_only) {
22+        double la = 0.0;
23+        xs *user_la = xs_dup(xs_dict_get(user->config, "last_announcement"));
24+        if (user_la != NULL)
25+            la = xs_number_get(user_la);
26+
27+        const t_announcement *an = announcement(la);
28+        if (an != NULL && (an->text != NULL)) {
29+            xs *s = xs_fmt("?da=%.0f", an->timestamp);
30+
31+            xs_html_add(top_user,  xs_html_tag("div",
32+                xs_html_attr("class", "snac-announcement"),
33+                    xs_html_text(an->text),
34+                    xs_html_text(" "),
35+                    xs_html_tag("a",
36+                            xs_html_attr("href", s),
37+                            xs_html_text("Dismiss"))));
38+        }
39     }
40 
41     if (read_only) {