commit 2b81428
default
·
2024-02-21 07:00:03 +0000 UTC
parent 4fa0264
Renamed 'local' argument to 'read_only', as it was a bit confusing.
1 files changed,
+13,
-13
M
html.c
M
html.c
+13,
-13
1@@ -646,7 +646,7 @@ xs_html *html_user_head(snac *user, char *desc)
2 }
3
4
5-static xs_html *html_user_body(snac *user, int local)
6+static xs_html *html_user_body(snac *user, int read_only)
7 {
8 xs_html *body = xs_html_tag("body", NULL);
9
10@@ -667,7 +667,7 @@ static xs_html *html_user_body(snac *user, int local)
11 xs_html_attr("class", "snac-avatar"),
12 xs_html_attr("alt", "")));
13
14- if (local) {
15+ if (read_only) {
16 xs *rss_url = xs_fmt("%s.rss", user->actor);
17 xs *admin_url = xs_fmt("%s/admin", user->actor);
18
19@@ -724,7 +724,7 @@ static xs_html *html_user_body(snac *user, int local)
20 xs_html *top_user = xs_html_tag("div",
21 xs_html_attr("class", "h-card snac-top-user"));
22
23- if (local) {
24+ if (read_only) {
25 char *header = xs_dict_get(user->config, "header");
26 if (header && *header) {
27 xs_html_add(top_user,
28@@ -749,7 +749,7 @@ static xs_html *html_user_body(snac *user, int local)
29 xs_html_attr("class", "snac-top-user-id"),
30 xs_html_text(handle)));
31
32- if (local) {
33+ if (read_only) {
34 xs *es1 = encode_html(xs_dict_get(user->config, "bio"));
35 xs *bio1 = not_really_markdown(es1, NULL);
36 xs *tags = xs_list_new();
37@@ -1306,7 +1306,7 @@ xs_html *html_entry_controls(snac *snac, char *actor, const xs_dict *msg, const
38 }
39
40
41-xs_html *html_entry(snac *user, xs_dict *msg, int local,
42+xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
43 int level, char *md5, int hide_children)
44 {
45 char *id = xs_dict_get(msg, "id");
46@@ -1315,7 +1315,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
47 char *v;
48
49 /* do not show non-public messages in the public timeline */
50- if ((local || !user) && !is_msg_public(msg))
51+ if ((read_only || !user) && !is_msg_public(msg))
52 return NULL;
53
54 /* hidden? do nothing more for this conversation */
55@@ -1334,7 +1334,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
56 xs_html_tag("div",
57 xs_html_attr("class", "snac-origin"),
58 xs_html_text(L("follows you"))),
59- html_msg_icon(local ? NULL : user, xs_dict_get(msg, "actor"), msg)));
60+ html_msg_icon(read_only ? NULL : user, xs_dict_get(msg, "actor"), msg)));
61 }
62 else
63 if (!xs_match(type, "Note|Question|Page|Article|Video")) {
64@@ -1446,7 +1446,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
65 if (!xs_is_null(name)) {
66 xs *href = NULL;
67
68- if (!local && user != NULL)
69+ if (!read_only && user != NULL)
70 href = xs_fmt("%s/people#%s", user->actor, p);
71 else
72 href = xs_dup(xs_dict_get(actor_r, "id"));
73@@ -1482,7 +1482,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
74 }
75
76 xs_html_add(post_header,
77- html_msg_icon(local ? NULL : user, actor, msg));
78+ html_msg_icon(read_only ? NULL : user, actor, msg));
79
80 /** post content **/
81
82@@ -1510,7 +1510,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
83
84 /* only show it when not in the public timeline and the config setting is "open" */
85 char *cw = xs_dict_get(user->config, "cw");
86- if (xs_is_null(cw) || local)
87+ if (xs_is_null(cw) || read_only)
88 cw = "";
89
90 snac_content = xs_html_tag("details",
91@@ -1574,7 +1574,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
92
93 xs_html *poll = xs_html_tag("div", NULL);
94
95- if (local)
96+ if (read_only)
97 closed = 1; /* non-identified page; show as closed */
98 else
99 if (xs_dict_get(msg, "closed"))
100@@ -1795,7 +1795,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
101
102 /** controls **/
103
104- if (!local && user) {
105+ if (!read_only && user) {
106 xs_html_add(entry,
107 html_entry_controls(user, actor, msg, md5));
108 }
109@@ -1839,7 +1839,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
110 object_get_by_md5(cmd5, &chd);
111
112 if (chd != NULL && xs_is_null(xs_dict_get(chd, "name"))) {
113- xs_html *che = html_entry(user, chd, local, level + 1, cmd5, hide_children);
114+ xs_html *che = html_entry(user, chd, read_only, level + 1, cmd5, hide_children);
115
116 if (che != NULL) {
117 if (left > 3)