mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-25 18:55:44 +03:00
Prevent pinned posts from being grouped
This commit is contained in:
parent
3a326194ad
commit
770f4d9205
1 changed files with 16 additions and 0 deletions
|
@ -65,12 +65,28 @@ function Timeline({
|
|||
try {
|
||||
let { done, value } = await fetchItems(firstLoad);
|
||||
if (Array.isArray(value)) {
|
||||
// Avoid grouping for pinned posts
|
||||
const [pinnedPosts, otherPosts] = value.reduce(
|
||||
(acc, item) => {
|
||||
if (item._pinned) {
|
||||
acc[0].push(item);
|
||||
} else {
|
||||
acc[1].push(item);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
[[], []],
|
||||
);
|
||||
value = otherPosts;
|
||||
if (allowGrouping) {
|
||||
if (boostsCarousel) {
|
||||
value = groupBoosts(value);
|
||||
}
|
||||
value = groupContext(value);
|
||||
}
|
||||
if (pinnedPosts.length) {
|
||||
value = pinnedPosts.concat(value);
|
||||
}
|
||||
console.log(value);
|
||||
if (firstLoad) {
|
||||
setItems(value);
|
||||
|
|
Loading…
Reference in a new issue