diff --git a/src/index.html b/src/index.html index 7a5f01c..eca85ed 100644 --- a/src/index.html +++ b/src/index.html @@ -2357,6 +2357,11 @@
Separate multiple relays with commas. Changing relays clears the template cache.
+Blocked authors are hidden in all community feed views.
+${escapeHtml(name)}`;
+ const btn = document.createElement('button');
+ btn.type = 'button';
+ btn.textContent = 'Unblock';
+ btn.addEventListener('click', async () => {
+ _blockedAuthors.delete(pubkey);
+ removeBlockMeta(pubkey);
+ saveBlockedAuthors();
+ renderBlockedAuthors();
+ await refreshCommunityView();
+ });
+ row.appendChild(btn);
+ container.appendChild(row);
+ });
+ }
+
+ async function refreshCommunityView() {
+ const tab = _nostrBrowseTab || 'New';
+ if (tab === 'Mine') return loadMyDesigns();
+ return loadFeedTab(tab);
+ }
+
+ async function blockAuthor(pubkey, source = 'card') {
+ const normalized = normalizePubkey(pubkey);
+ if (!normalized) return;
+ _blockedAuthors.add(normalized);
+ _lastBlockedPubkey = normalized;
+ saveBlockedAuthors();
+ saveBlockMeta(normalized, source);
+ renderBlockedAuthors();
+ await refreshCommunityView();
+ const undo = confirm('Author blocked. Click OK to undo.');
+ if (undo && _lastBlockedPubkey === normalized) {
+ _blockedAuthors.delete(normalized);
+ removeBlockMeta(normalized);
+ saveBlockedAuthors();
+ renderBlockedAuthors();
+ await refreshCommunityView();
+ }
+ }
const _feedPagination = {
New: { rows: [], rendered: 0, chunk: 24, initialized: false },
Popular: { rows: [], rendered: 0, chunk: 24, initialized: false }
@@ -5719,6 +5835,8 @@
const latestByAddress = new Map();
for (const e of ordered) {
if (e.kind === 5) continue;
+ const authorPubkey = normalizePubkey(e.pubkey);
+ if (authorPubkey && _blockedAuthors.has(authorPubkey)) continue;
let payload = null;
try { payload = JSON.parse(e.content || '{}'); } catch { continue; }
if (!skipVersionFilter && (payload.version ?? 0) < MIN_SUPPORTED_SCHEMA_VERSION) continue;
@@ -5813,7 +5931,15 @@
const btn = document.createElement('button');
btn.type = 'button'; btn.textContent = 'Use';
btn.addEventListener('click', e => { e.stopPropagation(); onUse(); });
- actions.append(makeReactionBtn(row), prevBtn, btn);
+ const blockBtn = document.createElement('button');
+ blockBtn.type = 'button';
+ blockBtn.textContent = 'Block';
+ blockBtn.title = 'Block this author';
+ blockBtn.addEventListener('click', async e => {
+ e.stopPropagation();
+ await blockAuthor(row.e?.pubkey, 'card');
+ });
+ actions.append(makeReactionBtn(row), prevBtn, btn, blockBtn);
el.append(thumb, meta, actions);
el.addEventListener('click', () => openDesignPreview(row));
return el;
@@ -5993,7 +6119,7 @@
}
wall.innerHTML = '';
if (!rows.length) {
- wall.innerHTML = '