diff options
| -rw-r--r-- | RELEASE_NOTES.md | 2 | ||||
| -rw-r--r-- | html.c | 37 |
2 files changed, 30 insertions, 9 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 8e95766..c6d439d 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md | |||
| @@ -14,6 +14,8 @@ Allow multiple editors for command-line posts (contributed by inz). | |||
| 14 | 14 | ||
| 15 | Separated maximum and default timeline entry count, allowing larger timelines to be requested without having to increase the default (contributed by lxo). | 15 | Separated maximum and default timeline entry count, allowing larger timelines to be requested without having to increase the default (contributed by lxo). |
| 16 | 16 | ||
| 17 | Turned message date into a link to the local post, so that it can be loaded into a separate tab for interacting with (contributed by lxo). | ||
| 18 | |||
| 17 | Special thanks to fellow developer inz for bringing my attention to code places where I should have been more careful. | 19 | Special thanks to fellow developer inz for bringing my attention to code places where I should have been more careful. |
| 18 | 20 | ||
| 19 | ## 2.71 | 21 | ## 2.71 |
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "xs_html.h" | 13 | #include "xs_html.h" |
| 14 | #include "xs_curl.h" | 14 | #include "xs_curl.h" |
| 15 | #include "xs_unicode.h" | 15 | #include "xs_unicode.h" |
| 16 | #include "xs_url.h" | ||
| 16 | 17 | ||
| 17 | #include "snac.h" | 18 | #include "snac.h" |
| 18 | 19 | ||
| @@ -115,7 +116,8 @@ xs_str *actor_name(xs_dict *actor, const char *proxy) | |||
| 115 | 116 | ||
| 116 | xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date, | 117 | xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date, |
| 117 | const char *udate, const char *url, int priv, | 118 | const char *udate, const char *url, int priv, |
| 118 | int in_people, const char *proxy, const char *lang) | 119 | int in_people, const char *proxy, const char *lang, |
| 120 | const char *md5) | ||
| 119 | { | 121 | { |
| 120 | xs_html *actor_icon = xs_html_tag("p", NULL); | 122 | xs_html *actor_icon = xs_html_tag("p", NULL); |
| 121 | 123 | ||
| @@ -224,12 +226,29 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date, | |||
| 224 | if (xs_is_string(lang)) | 226 | if (xs_is_string(lang)) |
| 225 | date_title = xs_str_cat(date_title, " (", lang, ")"); | 227 | date_title = xs_str_cat(date_title, " (", lang, ")"); |
| 226 | 228 | ||
| 229 | xs_html *date_text = xs_html_text(date_label); | ||
| 230 | |||
| 231 | if (user && md5) { | ||
| 232 | xs *lpost_url = xs_fmt("%s/admin/p/%s", | ||
| 233 | user->actor, md5); | ||
| 234 | date_text = xs_html_tag("a", | ||
| 235 | xs_html_attr("href", lpost_url), | ||
| 236 | date_text); | ||
| 237 | } | ||
| 238 | else if (user && url) { | ||
| 239 | xs *lpost_url = xs_fmt("%s/admin?q=%s", | ||
| 240 | user->actor, xs_url_enc(url)); | ||
| 241 | date_text = xs_html_tag("a", | ||
| 242 | xs_html_attr("href", lpost_url), | ||
| 243 | date_text); | ||
| 244 | } | ||
| 245 | |||
| 227 | xs_html_add(actor_icon, | 246 | xs_html_add(actor_icon, |
| 228 | xs_html_text(" "), | 247 | xs_html_text(" "), |
| 229 | xs_html_tag("time", | 248 | xs_html_tag("time", |
| 230 | xs_html_attr("class", "dt-published snac-pubdate"), | 249 | xs_html_attr("class", "dt-published snac-pubdate"), |
| 231 | xs_html_attr("title", date_title), | 250 | xs_html_attr("title", date_title), |
| 232 | xs_html_text(date_label))); | 251 | date_text)); |
| 233 | } | 252 | } |
| 234 | 253 | ||
| 235 | { | 254 | { |
| @@ -261,7 +280,7 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date, | |||
| 261 | } | 280 | } |
| 262 | 281 | ||
| 263 | 282 | ||
| 264 | xs_html *html_msg_icon(snac *user, const char *actor_id, const xs_dict *msg, const char *proxy) | 283 | xs_html *html_msg_icon(snac *user, const char *actor_id, const xs_dict *msg, const char *proxy, const char *md5) |
| 265 | { | 284 | { |
| 266 | xs *actor = NULL; | 285 | xs *actor = NULL; |
| 267 | xs_html *actor_icon = NULL; | 286 | xs_html *actor_icon = NULL; |
| @@ -292,7 +311,7 @@ xs_html *html_msg_icon(snac *user, const char *actor_id, const xs_dict *msg, con | |||
| 292 | else | 311 | else |
| 293 | lang = NULL; | 312 | lang = NULL; |
| 294 | 313 | ||
| 295 | actor_icon = html_actor_icon(user, actor, date, udate, url, priv, 0, proxy, lang); | 314 | actor_icon = html_actor_icon(user, actor, date, udate, url, priv, 0, proxy, lang, md5); |
| 296 | } | 315 | } |
| 297 | 316 | ||
| 298 | return actor_icon; | 317 | return actor_icon; |
| @@ -1706,7 +1725,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 1706 | xs_html_tag("div", | 1725 | xs_html_tag("div", |
| 1707 | xs_html_attr("class", "snac-origin"), | 1726 | xs_html_attr("class", "snac-origin"), |
| 1708 | xs_html_text(L("follows you"))), | 1727 | xs_html_text(L("follows you"))), |
| 1709 | html_msg_icon(read_only ? NULL : user, xs_dict_get(msg, "actor"), msg, proxy))); | 1728 | html_msg_icon(read_only ? NULL : user, xs_dict_get(msg, "actor"), msg, proxy, NULL))); |
| 1710 | } | 1729 | } |
| 1711 | else | 1730 | else |
| 1712 | if (!xs_match(type, POSTLIKE_OBJECT_TYPE)) { | 1731 | if (!xs_match(type, POSTLIKE_OBJECT_TYPE)) { |
| @@ -1887,7 +1906,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 1887 | } | 1906 | } |
| 1888 | 1907 | ||
| 1889 | xs_html_add(post_header, | 1908 | xs_html_add(post_header, |
| 1890 | html_msg_icon(read_only ? NULL : user, actor, msg, proxy)); | 1909 | html_msg_icon(read_only ? NULL : user, actor, msg, proxy, md5)); |
| 1891 | 1910 | ||
| 1892 | /** post content **/ | 1911 | /** post content **/ |
| 1893 | 1912 | ||
| @@ -2820,7 +2839,7 @@ xs_html *html_people_list(snac *snac, xs_list *list, char *header, char *t, cons | |||
| 2820 | xs_html_tag("div", | 2839 | xs_html_tag("div", |
| 2821 | xs_html_attr("class", "snac-post-header"), | 2840 | xs_html_attr("class", "snac-post-header"), |
| 2822 | html_actor_icon(snac, actor, xs_dict_get(actor, "published"), | 2841 | html_actor_icon(snac, actor, xs_dict_get(actor, "published"), |
| 2823 | NULL, NULL, 0, 1, proxy, NULL))); | 2842 | NULL, NULL, 0, 1, proxy, NULL, NULL))); |
| 2824 | 2843 | ||
| 2825 | /* content (user bio) */ | 2844 | /* content (user bio) */ |
| 2826 | const char *c = xs_dict_get(actor, "summary"); | 2845 | const char *c = xs_dict_get(actor, "summary"); |
| @@ -3118,7 +3137,7 @@ xs_str *html_notifications(snac *user, int skip, int show) | |||
| 3118 | xs_html_add(entry, | 3137 | xs_html_add(entry, |
| 3119 | xs_html_tag("div", | 3138 | xs_html_tag("div", |
| 3120 | xs_html_attr("class", "snac-post"), | 3139 | xs_html_attr("class", "snac-post"), |
| 3121 | html_actor_icon(user, actor, NULL, NULL, NULL, 0, 0, proxy, NULL))); | 3140 | html_actor_icon(user, actor, NULL, NULL, NULL, 0, 0, proxy, NULL, NULL))); |
| 3122 | } | 3141 | } |
| 3123 | else | 3142 | else |
| 3124 | if (strcmp(type, "Move") == 0) { | 3143 | if (strcmp(type, "Move") == 0) { |
| @@ -3132,7 +3151,7 @@ xs_str *html_notifications(snac *user, int skip, int show) | |||
| 3132 | xs_html_add(entry, | 3151 | xs_html_add(entry, |
| 3133 | xs_html_tag("div", | 3152 | xs_html_tag("div", |
| 3134 | xs_html_attr("class", "snac-post"), | 3153 | xs_html_attr("class", "snac-post"), |
| 3135 | html_actor_icon(user, old_actor, NULL, NULL, NULL, 0, 0, proxy, NULL))); | 3154 | html_actor_icon(user, old_actor, NULL, NULL, NULL, 0, 0, proxy, NULL, NULL))); |
| 3136 | } | 3155 | } |
| 3137 | } | 3156 | } |
| 3138 | } | 3157 | } |