Filter out duplicate carousel cards

Also respect reply config option in carousel
This commit is contained in:
Max L. 2023-11-24 12:08:19 +01:00
parent 3ba54e1653
commit 12fca72480
No known key found for this signature in database
GPG key ID: 2F963B95632B8467

View file

@ -165,9 +165,17 @@ const updateCarousel = function(slides, posts) {
var newHTML = ` <!-- No Indicators -->`
newHTML += `<!-- the slides -->
<div class="carousel-inner">
`
`;
let existingCards = [];
for( let i = 0; i < posts.length; i++ ) {
let post = posts[i];
if (existingCards.includes(post.id) || (!includeReplies && post.in_reply_to_id !== null)) continue;
existingCards.push(post.id);
/*console.log( post.content )*/
if ( i == 0 ) {
newHTML += `<div class="carousel-item active" data-mdb-interval="${duration}" data-mdb-pause="false">`;