mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-29 16:31:04 +00:00
fix replies to parents the user doesn't follow
This commit is contained in:
parent
5867fbf322
commit
3fac46e2e2
@ -114,14 +114,14 @@ export class ContextLoader {
|
||||
const repliesByParentId = {} as Record<string, Event[]>
|
||||
|
||||
for (const event of this.data.get()) {
|
||||
const parentId = findReplyId(event)
|
||||
|
||||
if (contextById[event.id]) {
|
||||
continue
|
||||
}
|
||||
|
||||
contextById[event.id] = event
|
||||
|
||||
const parentId = findReplyId(event)
|
||||
|
||||
if (event.kind === 9735) {
|
||||
pushToKey(zapsByParentId, parentId, event)
|
||||
} else if (event.kind === 7) {
|
||||
|
@ -107,10 +107,8 @@ export class FeedLoader {
|
||||
addToFeed = (notes: Event[]) => {
|
||||
this.feed.update($feed => {
|
||||
// Avoid showing the same note twice, even if it's once as a parent and once as a child
|
||||
const feedIds = pluck("id", $feed)
|
||||
const feedParentIds = $feed.map(findReplyId).filter(identity)
|
||||
const noteParentIds = notes.map(findReplyId).filter(identity)
|
||||
const ids = new Set([...feedIds, ...feedParentIds, ...noteParentIds])
|
||||
const feedIds = new Set(pluck("id", $feed))
|
||||
const feedParentIds = new Set($feed.map(findReplyId).filter(identity))
|
||||
|
||||
return uniqBy(
|
||||
prop("id"),
|
||||
@ -118,7 +116,7 @@ export class FeedLoader {
|
||||
this.context.applyContext(
|
||||
sortBy(
|
||||
e => -e.created_at,
|
||||
notes.filter(e => !ids.has(findReplyId(e)))
|
||||
notes.filter(e => !feedIds.has(findReplyId(e)) && !feedParentIds.has(e.id))
|
||||
),
|
||||
true
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user