diff options
| author | 2025-01-12 11:57:30 +0100 | |
|---|---|---|
| committer | 2025-01-12 11:57:30 +0100 | |
| commit | 6154ce75826ccb4ade18a45b838d159cd26d81f8 (patch) | |
| tree | fe97407446749212a308d081cc85d3f54cffd425 /html.c | |
| parent | mastoapi: fixed Events not being shown. (diff) | |
| download | snac2-6154ce75826ccb4ade18a45b838d159cd26d81f8.tar.gz snac2-6154ce75826ccb4ade18a45b838d159cd26d81f8.tar.xz snac2-6154ce75826ccb4ade18a45b838d159cd26d81f8.zip | |
If an Event has an URL, use it.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 11 |
1 files changed, 11 insertions, 0 deletions
| @@ -2239,8 +2239,19 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2239 | label_list = xs_list_append(label_list, address); | 2239 | label_list = xs_list_append(label_list, address); |
| 2240 | 2240 | ||
| 2241 | if (xs_list_len(label_list)) { | 2241 | if (xs_list_len(label_list)) { |
| 2242 | const char *url = xs_dict_get(location, "url"); | ||
| 2242 | xs *label = xs_join(label_list, ", "); | 2243 | xs *label = xs_join(label_list, ", "); |
| 2243 | 2244 | ||
| 2245 | if (xs_type(url) == XSTYPE_STRING) { | ||
| 2246 | xs_html_add(snac_content_wrap, | ||
| 2247 | xs_html_tag("p", | ||
| 2248 | xs_html_text(L("Location: ")), | ||
| 2249 | xs_html_tag("a", | ||
| 2250 | xs_html_attr("href", url), | ||
| 2251 | xs_html_attr("target", "_blank"), | ||
| 2252 | xs_html_text(label)))); | ||
| 2253 | } | ||
| 2254 | else | ||
| 2244 | if (!xs_is_null(latitude) && !xs_is_null(longitude)) { | 2255 | if (!xs_is_null(latitude) && !xs_is_null(longitude)) { |
| 2245 | xs *url = xs_fmt("https://openstreetmap.org/search/?query=%s,%s", | 2256 | xs *url = xs_fmt("https://openstreetmap.org/search/?query=%s,%s", |
| 2246 | xs_number_str(latitude), xs_number_str(longitude)); | 2257 | xs_number_str(latitude), xs_number_str(longitude)); |