From ab8f5569be06992957966bc87e4e2d9ebc75ca9b Mon Sep 17 00:00:00 2001 From: blankie Date: Wed, 29 Nov 2023 15:44:03 +1100 Subject: [PATCH] Fix missing margins in user bio https://social.kernel.org/@monsieuricon --- routes/user.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/routes/user.cpp b/routes/user.cpp index 7cb80b7..e6131e0 100644 --- a/routes/user.cpp +++ b/routes/user.cpp @@ -82,6 +82,14 @@ static inline PostSortingMethod get_sorting_method(const std::string& method) { static inline Element user_header(const httplib::Request& req, const std::string& server, const Account& account, PostSortingMethod sorting_method) { + blankie::html::HTMLString preprocessed_bio = preprocess_html(req, account.server, account.emojis, account.note_html); + // Workaround for https://social.kernel.org/@monsieuricon + if (preprocessed_bio.str.find("

") == std::string::npos) { + preprocessed_bio.str.reserve(preprocessed_bio.str.size() + 3 + 4); + preprocessed_bio.str.insert(0, "

"); + preprocessed_bio.str.append("

"); + } + Element user_links("table", {{"class", "user_page-user_links"}}, {}); user_links.nodes.reserve(account.fields.size()); for (const AccountField& i : account.fields) { @@ -113,7 +121,7 @@ static inline Element user_header(const httplib::Request& req, const std::string }), Element("div", {{"class", "user_page-user_description"}}, { - Element("div", {{"class", "user_page-user_bio"}}, {preprocess_html(req, account.server, account.emojis, account.note_html)}), + Element("div", {{"class", "user_page-user_bio"}}, {std::move(preprocessed_bio)}), std::move(user_links), }),