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[]>
|
const repliesByParentId = {} as Record<string, Event[]>
|
||||||
|
|
||||||
for (const event of this.data.get()) {
|
for (const event of this.data.get()) {
|
||||||
const parentId = findReplyId(event)
|
|
||||||
|
|
||||||
if (contextById[event.id]) {
|
if (contextById[event.id]) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
contextById[event.id] = event
|
contextById[event.id] = event
|
||||||
|
|
||||||
|
const parentId = findReplyId(event)
|
||||||
|
|
||||||
if (event.kind === 9735) {
|
if (event.kind === 9735) {
|
||||||
pushToKey(zapsByParentId, parentId, event)
|
pushToKey(zapsByParentId, parentId, event)
|
||||||
} else if (event.kind === 7) {
|
} else if (event.kind === 7) {
|
||||||
|
@ -107,10 +107,8 @@ export class FeedLoader {
|
|||||||
addToFeed = (notes: Event[]) => {
|
addToFeed = (notes: Event[]) => {
|
||||||
this.feed.update($feed => {
|
this.feed.update($feed => {
|
||||||
// Avoid showing the same note twice, even if it's once as a parent and once as a child
|
// 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 feedIds = new Set(pluck("id", $feed))
|
||||||
const feedParentIds = $feed.map(findReplyId).filter(identity)
|
const feedParentIds = new Set($feed.map(findReplyId).filter(identity))
|
||||||
const noteParentIds = notes.map(findReplyId).filter(identity)
|
|
||||||
const ids = new Set([...feedIds, ...feedParentIds, ...noteParentIds])
|
|
||||||
|
|
||||||
return uniqBy(
|
return uniqBy(
|
||||||
prop("id"),
|
prop("id"),
|
||||||
@ -118,7 +116,7 @@ export class FeedLoader {
|
|||||||
this.context.applyContext(
|
this.context.applyContext(
|
||||||
sortBy(
|
sortBy(
|
||||||
e => -e.created_at,
|
e => -e.created_at,
|
||||||
notes.filter(e => !ids.has(findReplyId(e)))
|
notes.filter(e => !feedIds.has(findReplyId(e)) && !feedParentIds.has(e.id))
|
||||||
),
|
),
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user