Skip to content

Commit

Permalink
🥾 hide hidden replies and their replies
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie committed Nov 26, 2024
1 parent 5f686ee commit 4c7587d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions _extensions/bluesky-comments/bluesky-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class BlueskyCommentsSection extends HTMLElement {
this.attachShadow({ mode: 'open' })
this.visibleCount = 3
this.thread = null
this.hiddenReplies = null
this.error = null
}

Expand Down Expand Up @@ -38,6 +39,9 @@ class BlueskyCommentsSection extends HTMLElement {
try {
const thread = await this.fetchThread(uri)
this.thread = thread
if ('post' in thread && 'threadgate' in thread.post && thread.post.threadgate) {
this.hiddenReplies = thread.post.threadgate?.record?.hiddenReplies
}
this.render()
} catch (err) {
this.renderError('Error loading comments')
Expand Down Expand Up @@ -132,6 +136,9 @@ class BlueskyCommentsSection extends HTMLElement {
// Filter out blocked/not found replies
// and replies that only contain 📌
const filteredReplies = replies.filter(reply => {
if (this.hiddenReplies && this.hiddenReplies.includes(reply.post.uri)) {
return false
}
if ('blocked' in reply && reply.blocked) {
return false
}
Expand Down

0 comments on commit 4c7587d

Please sign in to comment.