diff --git a/src/apps/web/WebData.h b/src/apps/web/WebData.h index 1efedac..f04eb5d 100644 --- a/src/apps/web/WebData.h +++ b/src/apps/web/WebData.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + #include "re2/re2.h" #include "Bech32Utils.h" @@ -271,6 +274,9 @@ struct Event { auto firstUrl = stripUrls(content); preprocessEventContent(txn, decomp, userCache, content, false); + // If it was only a URL, just use raw URL + if (content.size() == 0 || std::all_of(content.begin(), content.end(), [](unsigned char c){ return std::isspace(c); })) content = firstUrl; + auto textAbbrev = [](std::string &str, size_t maxLen){ if (str.size() > maxLen) str = str.substr(0, maxLen-3) + "..."; }; @@ -600,9 +606,11 @@ struct EventThread { struct { TemplarResult foundEvents; std::vector orphanNodes; + bool isFullThreadLoaded; } ctx; ctx.foundEvents = process(rootEventId); + ctx.isFullThreadLoaded = isFullThreadLoaded; for (auto &[id, e] : eventCache) { if (processedLevIds.contains(e.ev.primaryKeyId)) continue; diff --git a/src/apps/web/tmpls/events.tmpl b/src/apps/web/tmpls/events.tmpl index d39babb..3518c16 100644 --- a/src/apps/web/tmpls/events.tmpl +++ b/src/apps/web/tmpls/events.tmpl @@ -1,7 +1,7 @@
$(ctx.foundEvents) -
?(ctx.orphanNodes.size() > 0) +
?(ctx.isFullThreadLoaded && ctx.orphanNodes.size() > 0) orphan notes (missing parents)