Fix missing margins in user bio

https://social.kernel.org/@monsieuricon
This commit is contained in:
blankie 2023-11-29 15:44:03 +11:00
parent a21c1e22bc
commit ab8f5569be
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 9 additions and 1 deletions

View File

@ -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) { 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("<p>") == std::string::npos) {
preprocessed_bio.str.reserve(preprocessed_bio.str.size() + 3 + 4);
preprocessed_bio.str.insert(0, "<p>");
preprocessed_bio.str.append("</p>");
}
Element user_links("table", {{"class", "user_page-user_links"}}, {}); Element user_links("table", {{"class", "user_page-user_links"}}, {});
user_links.nodes.reserve(account.fields.size()); user_links.nodes.reserve(account.fields.size());
for (const AccountField& i : account.fields) { 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_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), std::move(user_links),
}), }),