pl-fe: improve statuses deduplication

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-09-03 16:22:41 +02:00
parent e24ec07017
commit 9686fa4af0

View file

@ -136,7 +136,7 @@ const deduplicateStatuses = (statuses: any[]) => {
const deduplicatedStatuses: any[] = [];
for (const status of statuses) {
const reblogged = status.reblog && deduplicatedStatuses.find((deduplicatedStatuses) => deduplicatedStatuses.reblog?.id === status.reblog.id);
const reblogged = status.reblog && deduplicatedStatuses.find((deduplicatedStatus) => deduplicatedStatus.reblog?.id === status.reblog.id);
if (reblogged) {
if (reblogged.accounts) {
@ -145,7 +145,7 @@ const deduplicateStatuses = (statuses: any[]) => {
reblogged.accounts = [reblogged.account, status.account];
}
reblogged.id += ':' + status.id;
} else {
} else if (!deduplicatedStatuses.find((deduplicatedStatus) => deduplicatedStatus.reblog?.id === status.id)) {
deduplicatedStatuses.push(status);
}
}