Thread viewer for Bluesky

add info about why hidden replies didn't load

Changed files
+36 -10
+30 -10
skythread.js
··· 718 718 /** @param {Post} post, @param {AnyElement} nodeToUpdate */ 719 719 720 720 function loadHiddenSubtree(post, nodeToUpdate) { 721 + let content = nodeToUpdate.querySelector('.content'); 722 + let hiddenRepliesDiv = content.querySelector(':scope > .hidden-replies'); 723 + 721 724 blueAPI.getReplies(post.uri).then(replies => { 722 725 let missingReplies = replies.filter(r => !post.replies.some(x => x.uri === r)); 723 726 ··· 727 730 .filter(v => v) 728 731 .map(json => Post.parseThreadPost(json.thread, post.pageRoot, 1, post.absoluteLevel + 1)); 729 732 730 - if (replies.length < responses.length) { 731 - // TODO 732 - console.log((responses.length - replies.length) + " replies missing"); 733 - } 734 - 735 733 post.setReplies(replies); 736 - 737 - let content = nodeToUpdate.querySelector('.content'); 738 - content.querySelector(':scope > .hidden-replies').remove(); 734 + hiddenRepliesDiv.remove(); 739 735 740 736 for (let reply of post.replies) { 741 737 let component = new PostComponent(reply, 'thread'); 742 738 let view = component.buildElement(); 743 739 content.append(view); 744 740 } 745 - }).catch(showError); 746 - }).catch(showError); 741 + 742 + if (replies.length < responses.length) { 743 + let notFoundCount = responses.length - replies.length; 744 + let pluralizedCount = notFoundCount + ' ' + ((notFoundCount > 1) ? 'replies are' : 'reply is'); 745 + 746 + let info = $tag('p.missing-replies-info', { 747 + html: `<i class="fa-solid fa-ban"></i> ${pluralizedCount} missing (likely taken down by moderation)` 748 + }); 749 + content.append(info); 750 + } 751 + }).catch(error => { 752 + hiddenRepliesDiv.remove(); 753 + setTimeout(() => showError(error), 1); 754 + }); 755 + }).catch(error => { 756 + hiddenRepliesDiv.remove(); 757 + 758 + if (error instanceof APIError && error.code == 404) { 759 + let info = $tag('p.missing-replies-info', { 760 + html: `<i class="fa-solid fa-ban"></i> Hidden replies not available (post too old)` 761 + }); 762 + content.append(info); 763 + } else { 764 + setTimeout(() => showError(error), 1); 765 + } 766 + }); 747 767 }
+6
style.css
··· 703 703 color: saddlebrown; 704 704 } 705 705 706 + .post p.missing-replies-info { 707 + font-size: 11pt; 708 + color: darkred; 709 + margin-top: 25px; 710 + } 711 + 706 712 @media (prefers-color-scheme: dark) { 707 713 body { 708 714 background-color: rgb(39, 39, 37);