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;
|
totalDescendants.current = descendants?.length || 0;
|
||||||
|
|
||||||
|
const missingStatuses = new Set();
|
||||||
ancestors.forEach((status) => {
|
ancestors.forEach((status) => {
|
||||||
saveStatus(status, instance, {
|
saveStatus(status, instance, {
|
||||||
skipThreading: true,
|
skipThreading: true,
|
||||||
});
|
});
|
||||||
|
if (
|
||||||
|
status.inReplyToId &&
|
||||||
|
!ancestors.find((s) => s.id === status.inReplyToId)
|
||||||
|
) {
|
||||||
|
missingStatuses.add(status.inReplyToId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const ancestorsIsThread = ancestors.every(
|
const ancestorsIsThread = ancestors.every(
|
||||||
(s) => s.account.id === heroStatus.account.id,
|
(s) => s.account.id === heroStatus.account.id,
|
||||||
|
@ -261,6 +268,14 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
||||||
saveStatus(status, instance, {
|
saveStatus(status, instance, {
|
||||||
skipThreading: true,
|
skipThreading: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (
|
||||||
|
status.inReplyToId &&
|
||||||
|
!descendants.find((s) => s.id === status.inReplyToId)
|
||||||
|
) {
|
||||||
|
missingStatuses.add(status.inReplyToId);
|
||||||
|
}
|
||||||
|
|
||||||
if (status.inReplyToAccountId === status.account.id) {
|
if (status.inReplyToAccountId === status.account.id) {
|
||||||
// If replying to self, it's part of the thread, level 1
|
// If replying to self, it's part of the thread, level 1
|
||||||
nestedDescendants.push(status);
|
nestedDescendants.push(status);
|
||||||
|
@ -290,6 +305,9 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log({ ancestors, descendants, nestedDescendants });
|
console.log({ ancestors, descendants, nestedDescendants });
|
||||||
|
if (missingStatuses.size) {
|
||||||
|
console.error('Missing statuses', [...missingStatuses]);
|
||||||
|
}
|
||||||
|
|
||||||
function expandReplies(_replies) {
|
function expandReplies(_replies) {
|
||||||
return _replies?.map((_r) => ({
|
return _replies?.map((_r) => ({
|
||||||
|
|
Loading…
Add table
Reference in a new issue