Fix displaying posts with no account information
https://dlx.pink/notice/AbtdJkjioOo8ZSdDhw
This commit is contained in:
parent
ebc055ee0a
commit
8462aa21bb
|
@ -32,6 +32,11 @@ static std::regex host_regex(R"EOF(https?://([a-z0-9-.]+)/.+)EOF", std::regex::E
|
||||||
void from_json(const json& j, Account& account) {
|
void from_json(const json& j, Account& account) {
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
|
// https://dlx.pink/notice/AbtdJkjioOo8ZSdDhw
|
||||||
|
if (j.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
j.at("id").get_to(account.id);
|
j.at("id").get_to(account.id);
|
||||||
j.at("username").get_to(account.username);
|
j.at("username").get_to(account.username);
|
||||||
j.at("display_name").get_to(account.display_name);
|
j.at("display_name").get_to(account.display_name);
|
||||||
|
|
|
@ -32,7 +32,8 @@ void status_route(const httplib::Request& req, httplib::Response& res) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (post->reblog) {
|
// https://dlx.pink/notice/AbtdJkjioOo8ZSdDhw
|
||||||
|
if (post->reblog && !post->reblog->account.id.empty()) {
|
||||||
serve_redirect(req, res, get_origin(req) + '/' + server + "/@" + post->reblog->account.acct(false) + '/' + post->reblog->id, true);
|
serve_redirect(req, res, get_origin(req) + '/' + server + "/@" + post->reblog->account.acct(false) + '/' + post->reblog->id, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,13 +478,13 @@ static Element serialize_post(const httplib::Request& req, const std::string& se
|
||||||
|
|
||||||
Element div("div", {{"class", "post"}}, {
|
Element div("div", {{"class", "post"}}, {
|
||||||
Element("div", {{"class", "post-header"}}, {
|
Element("div", {{"class", "post-header"}}, {
|
||||||
Element("a", {{"href", get_origin(req) + '/' + server + "/@" + post.account.acct(false)}}, {
|
!post.account.id.empty() ? Element("a", {{"href", get_origin(req) + '/' + server + "/@" + post.account.acct(false)}}, {
|
||||||
Element("img", {{"class", "post-avatar"}, {"alt", "User profile picture"}, {"loading", "lazy"}, {"src", post.account.avatar_static}}, {}),
|
Element("img", {{"class", "post-avatar"}, {"alt", "User profile picture"}, {"loading", "lazy"}, {"src", post.account.avatar_static}}, {}),
|
||||||
Element("span", {
|
Element("span", {
|
||||||
Element("b", {preprocess_html(req, post.account.emojis, post.account.display_name)}),
|
Element("b", {preprocess_html(req, post.account.emojis, post.account.display_name)}),
|
||||||
Element("br"), "@", post.account.acct(),
|
Element("br"), "@", post.account.acct(),
|
||||||
}),
|
}),
|
||||||
}),
|
}) : Element("b", {"Unknown user"}),
|
||||||
Element("a", {{"class", "post-time_header"}, {"href", get_origin(req) + '/' + server + "/@" + post.account.acct(false) + '/' + post.id + "#m"}, {"title", time_title}}, {
|
Element("a", {{"class", "post-time_header"}, {"href", get_origin(req) + '/' + server + "/@" + post.account.acct(false) + '/' + post.id + "#m"}, {"title", time_title}}, {
|
||||||
Element("time", {{"datetime", to_rfc3339(post.created_at)}}, {relative_time(post.created_at, current_time()), time_badge}),
|
Element("time", {{"datetime", to_rfc3339(post.created_at)}}, {relative_time(post.created_at, current_time()), time_badge}),
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue