Skip to content

Commit

Permalink
📌 Remove just pin replies
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie committed Nov 26, 2024
1 parent 45e56f5 commit 4ba6132
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion _extensions/bluesky-comments/bluesky-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,18 @@ class BlueskyCommentsSection extends HTMLElement {
return
}

const sortedReplies = this.thread.replies.sort(
// Filter out replies that only contain 📌
const filteredReplies = this.thread.replies.filter(reply => {
const text = reply.post.record?.text || ''
return text.trim() !== '📌'
})

if (!filteredReplies) {
this.renderError('No comments found')
return
}

const sortedReplies = filteredReplies.sort(
(a, b) => (b.post.likeCount ?? 0) - (a.post.likeCount ?? 0)
)

Expand Down Expand Up @@ -161,6 +172,7 @@ class BlueskyCommentsSection extends HTMLElement {

reply.replies
.sort((a, b) => (b.post.likeCount ?? 0) - (a.post.likeCount ?? 0))
.filter(p => (p.post.record?.text || '').trim() !== '📌')
.forEach((childReply) => {
repliesContainer.appendChild(this.createCommentElement(childReply))
})
Expand Down

0 comments on commit 4ba6132

Please sign in to comment.