mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-14 12:18:30 +03:00
Add check for "missing" statuses in context
This commit is contained in:
parent
104665cafe
commit
1f7912d6b8
1 changed files with 18 additions and 0 deletions
|
@ -248,10 +248,17 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
|||
|
||||
totalDescendants.current = descendants?.length || 0;
|
||||
|
||||
const missingStatuses = new Set();
|
||||
ancestors.forEach((status) => {
|
||||
saveStatus(status, instance, {
|
||||
skipThreading: true,
|
||||
});
|
||||
if (
|
||||
status.inReplyToId &&
|
||||
!ancestors.find((s) => s.id === status.inReplyToId)
|
||||
) {
|
||||
missingStatuses.add(status.inReplyToId);
|
||||
}
|
||||
});
|
||||
const ancestorsIsThread = ancestors.every(
|
||||
(s) => s.account.id === heroStatus.account.id,
|
||||
|
@ -261,6 +268,14 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
|||
saveStatus(status, instance, {
|
||||
skipThreading: true,
|
||||
});
|
||||
|
||||
if (
|
||||
status.inReplyToId &&
|
||||
!descendants.find((s) => s.id === status.inReplyToId)
|
||||
) {
|
||||
missingStatuses.add(status.inReplyToId);
|
||||
}
|
||||
|
||||
if (status.inReplyToAccountId === status.account.id) {
|
||||
// If replying to self, it's part of the thread, level 1
|
||||
nestedDescendants.push(status);
|
||||
|
@ -290,6 +305,9 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
|||
});
|
||||
|
||||
console.log({ ancestors, descendants, nestedDescendants });
|
||||
if (missingStatuses.size) {
|
||||
console.error('Missing statuses', [...missingStatuses]);
|
||||
}
|
||||
|
||||
function expandReplies(_replies) {
|
||||
return _replies?.map((_r) => ({
|
||||
|
|
Loading…
Add table
Reference in a new issue