|
@@ -3827,23 +3827,27 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
|
|
|
const xs_dict *location = xs_dict_get(actor, "location");
|
|
const xs_dict *location = xs_dict_get(actor, "location");
|
|
|
|
|
|
|
|
if (xs_is_dict(location)) {
|
|
if (xs_is_dict(location)) {
|
|
|
- const xs_val *latitude = xs_dict_get_def(location, "latitude", xs_stock(0));
|
|
|
|
|
- const xs_val *longitude = xs_dict_get_def(location, "longitude", xs_stock(0));
|
|
|
|
|
- const char *name = xs_dict_get_def(location, "name", "Home");
|
|
|
|
|
|
|
+ const xs_val *latitude = xs_dict_get(location, "latitude");
|
|
|
|
|
+ const xs_val *longitude = xs_dict_get(location, "longitude");
|
|
|
|
|
|
|
|
- if (*latitude && *longitude) {
|
|
|
|
|
- xs *label = xs_fmt("%s,%s", xs_number_str(latitude), xs_number_str(longitude));
|
|
|
|
|
- xs *url = xs_fmt("https://openstreetmap.org/search?query=%s,%s",
|
|
|
|
|
- latitude, longitude);
|
|
|
|
|
|
|
+ if (latitude && longitude) {
|
|
|
|
|
+ const char *name = xs_dict_get_def(location, "name", "Home");
|
|
|
|
|
+ const char *la = xs_is_string(latitude) ? latitude : xs_number_str(latitude);
|
|
|
|
|
+ const char *lo = xs_is_string(longitude) ? longitude : xs_number_str(longitude);
|
|
|
|
|
|
|
|
- xs_html_add(snac_post,
|
|
|
|
|
- xs_html_tag("p",
|
|
|
|
|
- xs_html_text(name),
|
|
|
|
|
- xs_html_text(": "),
|
|
|
|
|
- xs_html_tag("a",
|
|
|
|
|
- xs_html_attr("href", url),
|
|
|
|
|
- xs_html_attr("target", "_blank"),
|
|
|
|
|
- xs_html_text(label))));
|
|
|
|
|
|
|
+ if (xs_is_string(la) && xs_is_string(lo)) {
|
|
|
|
|
+ xs *label = xs_fmt("%s,%s", la, lo);
|
|
|
|
|
+ xs *url = xs_fmt("https://openstreetmap.org/search?query=%s,%s", la, lo);
|
|
|
|
|
+
|
|
|
|
|
+ xs_html_add(snac_post,
|
|
|
|
|
+ xs_html_tag("p",
|
|
|
|
|
+ xs_html_text(name),
|
|
|
|
|
+ xs_html_text(": "),
|
|
|
|
|
+ xs_html_tag("a",
|
|
|
|
|
+ xs_html_attr("href", url),
|
|
|
|
|
+ xs_html_attr("target", "_blank"),
|
|
|
|
|
+ xs_html_text(label))));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|