mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-29 04:38:55 +03:00
Merge dup boosts in Catch-up
This commit is contained in:
parent
0e1be5dbdc
commit
f5ea96a093
2 changed files with 43 additions and 3 deletions
|
@ -626,10 +626,24 @@
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
min-height: 24px;
|
||||||
|
|
||||||
.icon {
|
> .avatar {
|
||||||
|
outline: 1px solid var(--bg-blur-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
> .avatar ~ .avatar {
|
||||||
|
margin-left: -8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
> .icon {
|
||||||
color: var(--reblog-color);
|
color: var(--reblog-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> .name-text {
|
||||||
|
opacity: 0.75;
|
||||||
|
filter: grayscale(0.75);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-author {
|
.post-author {
|
||||||
|
|
|
@ -429,9 +429,29 @@ function Catchup() {
|
||||||
return postFilterMatches;
|
return postFilterMatches;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Deduplicate boosts
|
||||||
|
const boostedPosts = {};
|
||||||
|
filteredPosts = filteredPosts.filter((post) => {
|
||||||
|
if (post.reblog) {
|
||||||
|
if (boostedPosts[post.reblog.id]) {
|
||||||
|
if (boostedPosts[post.reblog.id].__BOOSTERS) {
|
||||||
|
boostedPosts[post.reblog.id].__BOOSTERS.add(post.account);
|
||||||
|
} else {
|
||||||
|
boostedPosts[post.reblog.id].__BOOSTERS = new Set([post.account]);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
boostedPosts[post.reblog.id] = post;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
if (selectedAuthor && authorCountsMap.has(selectedAuthor)) {
|
if (selectedAuthor && authorCountsMap.has(selectedAuthor)) {
|
||||||
filteredPosts = filteredPosts.filter(
|
filteredPosts = filteredPosts.filter(
|
||||||
(post) => post.account.id === selectedAuthor,
|
(post) =>
|
||||||
|
post.account.id === selectedAuthor ||
|
||||||
|
[...(post.__BOOSTERS || [])].find((a) => a.id === selectedAuthor),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1420,6 +1440,7 @@ const PostLine = memo(
|
||||||
_followedTags: isFollowedTags,
|
_followedTags: isFollowedTags,
|
||||||
_filtered: filterInfo,
|
_filtered: filterInfo,
|
||||||
visibility,
|
visibility,
|
||||||
|
__BOOSTERS,
|
||||||
} = post;
|
} = post;
|
||||||
const isReplyTo = inReplyToId && inReplyToAccountId !== account.id;
|
const isReplyTo = inReplyToId && inReplyToAccountId !== account.id;
|
||||||
const isFiltered = !!filterInfo;
|
const isFiltered = !!filterInfo;
|
||||||
|
@ -1453,7 +1474,12 @@ const PostLine = memo(
|
||||||
<Avatar
|
<Avatar
|
||||||
url={account.avatarStatic || account.avatar}
|
url={account.avatarStatic || account.avatar}
|
||||||
squircle={account.bot}
|
squircle={account.bot}
|
||||||
/>{' '}
|
/>
|
||||||
|
{__BOOSTERS?.size > 0
|
||||||
|
? [...__BOOSTERS].map((b) => (
|
||||||
|
<Avatar url={b.avatarStatic || b.avatar} squircle={b.bot} />
|
||||||
|
))
|
||||||
|
: ''}{' '}
|
||||||
<Icon icon="rocket" />{' '}
|
<Icon icon="rocket" />{' '}
|
||||||
{/* <Avatar
|
{/* <Avatar
|
||||||
url={reblog.account.avatarStatic || reblog.account.avatar}
|
url={reblog.account.avatarStatic || reblog.account.avatar}
|
||||||
|
|
Loading…
Reference in a new issue