Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hoytech committed Dec 20, 2024
1 parent aa29422 commit b7b6477
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/apps/web/WebData.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#pragma once

#include <algorithm>
#include <cctype>

#include "re2/re2.h"

#include "Bech32Utils.h"
Expand Down Expand Up @@ -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) + "...";
};
Expand Down Expand Up @@ -600,9 +606,11 @@ struct EventThread {
struct {
TemplarResult foundEvents;
std::vector<ReplyCtx> orphanNodes;
bool isFullThreadLoaded;
} ctx;

ctx.foundEvents = process(rootEventId);
ctx.isFullThreadLoaded = isFullThreadLoaded;

for (auto &[id, e] : eventCache) {
if (processedLevIds.contains(e.ev.primaryKeyId)) continue;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/web/tmpls/events.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="event-root">
$(ctx.foundEvents)

<div class="orphan-separator"> ?(ctx.orphanNodes.size() > 0)
<div class="orphan-separator"> ?(ctx.isFullThreadLoaded && ctx.orphanNodes.size() > 0)
<span>orphan notes (missing parents)</span>
</div>

Expand Down

0 comments on commit b7b6477

Please sign in to comment.