Simple working version, no pref for OP
This commit is contained in:
@@ -204,66 +204,66 @@ export function sort(
|
||||
/*
|
||||
* Not moderated, probably need to insert it
|
||||
*/
|
||||
// items.push(post)
|
||||
if (view === 'tree') {
|
||||
items.push(post)
|
||||
} else {
|
||||
if (post.depth > 1) {
|
||||
const maybeNextSiblingIndex = getBranch(thread, i, post.depth).end + 1
|
||||
const maybeNextSibling = thread.at(maybeNextSiblingIndex)
|
||||
items.push(post)
|
||||
// if (view === 'tree') {
|
||||
// items.push(post)
|
||||
// } else {
|
||||
// if (post.depth > 1) {
|
||||
// const maybeNextSiblingIndex = getBranch(thread, i, post.depth).end + 1
|
||||
// const maybeNextSibling = thread.at(maybeNextSiblingIndex)
|
||||
|
||||
/*
|
||||
* If we've got two replies at the same depth, we need to decide
|
||||
* which one to show.
|
||||
*/
|
||||
if (post.depth === maybeNextSibling?.depth) {
|
||||
// continue with next sibling
|
||||
i = maybeNextSiblingIndex - 1
|
||||
debugger;
|
||||
continue traversal
|
||||
} else {
|
||||
const maybePrevSiblingIndex = getBranchUp(thread, i - 1, post.depth).end
|
||||
const maybePrevSibling = thread.at(maybePrevSiblingIndex)
|
||||
// /*
|
||||
// * If we've got two replies at the same depth, we need to decide
|
||||
// * which one to show.
|
||||
// */
|
||||
// if (post.depth === maybeNextSibling?.depth) {
|
||||
// // continue with next sibling
|
||||
// i = maybeNextSiblingIndex - 1
|
||||
// debugger;
|
||||
// continue traversal
|
||||
// } else {
|
||||
// const maybePrevSiblingIndex = getBranchUp(thread, i - 1, post.depth).end
|
||||
// const maybePrevSibling = thread.at(maybePrevSiblingIndex)
|
||||
|
||||
if (post.depth === maybePrevSibling?.depth) {
|
||||
const post = views.threadPost({
|
||||
uri: item.uri,
|
||||
depth: item.depth,
|
||||
value: item.value,
|
||||
oneUp: thread.at(maybePrevSiblingIndex - 1),
|
||||
oneDown,
|
||||
moderationOpts,
|
||||
})
|
||||
debugger;
|
||||
items.push(post)
|
||||
} else {
|
||||
items.push(post)
|
||||
}
|
||||
}
|
||||
// if (post.depth === maybePrevSibling?.depth) {
|
||||
// const post = views.threadPost({
|
||||
// uri: item.uri,
|
||||
// depth: item.depth,
|
||||
// value: item.value,
|
||||
// oneUp: thread.at(maybePrevSiblingIndex - 1),
|
||||
// oneDown,
|
||||
// moderationOpts,
|
||||
// })
|
||||
// debugger;
|
||||
// items.push(post)
|
||||
// } else {
|
||||
// items.push(post)
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
if (post.depth === oneDown?.depth) {
|
||||
const opDid = new AtUri(post.value.post.record.reply?.root?.uri).host
|
||||
const postAuthorDid = new AtUri(post.uri).host
|
||||
debugger;
|
||||
if (postAuthorDid === opDid) {
|
||||
// prioritize OP optimistic reply
|
||||
items.push(post)
|
||||
// skip next reply
|
||||
i = getBranch(thread, i, oneDown.depth).end
|
||||
debugger;
|
||||
continue traversal
|
||||
} else {
|
||||
i = getBranch(thread, i, post.depth).end
|
||||
debugger;
|
||||
continue traversal
|
||||
}
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
items.push(post)
|
||||
}
|
||||
}
|
||||
// /*
|
||||
// if (post.depth === oneDown?.depth) {
|
||||
// const opDid = new AtUri(post.value.post.record.reply?.root?.uri).host
|
||||
// const postAuthorDid = new AtUri(post.uri).host
|
||||
// debugger;
|
||||
// if (postAuthorDid === opDid) {
|
||||
// // prioritize OP optimistic reply
|
||||
// items.push(post)
|
||||
// // skip next reply
|
||||
// i = getBranch(thread, i, oneDown.depth).end
|
||||
// debugger;
|
||||
// continue traversal
|
||||
// } else {
|
||||
// i = getBranch(thread, i, post.depth).end
|
||||
// debugger;
|
||||
// continue traversal
|
||||
// }
|
||||
// }
|
||||
// */
|
||||
// } else {
|
||||
// items.push(post)
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
/*
|
||||
* Moderated in some way, we're going to walk children
|
||||
|
||||
Reference in New Issue
Block a user