flagrow / ads

Allows you to configure ads in several locations
https://discuss.flarum.org/d/4785-flagrow-ads-bombarding-your-users-with-ads-everywhere-if-you-want
MIT License
18 stars 9 forks source link

Fix ads between posts #2

Closed clarkwinkelmann closed 7 years ago

clarkwinkelmann commented 7 years ago

After many trials and errors on the trail of @Luceos, I managed to find a solution that satisfies most (all ?) of the problems we had:

The following solutions were tested without success:

It looks like something is reordering the posts after the Mithril object is returned from PostStream.views(), probably based on the content of data-index, data-number or data-id. Given the way PostStream gives these numbers out there is no way to push an item with a valid, yet non-duplicated value of index/number/id without forcing to change all the numbers from all posts until the end of the discussion.

The current solution also works if we push ads items directly in the stream (they don't get reordered randomly). However, this breaks the PostStreamScrubber.

luceos commented 7 years ago

@clarkwinkelmann first, could you create an issue on @flarum/core? Feel free to relate back to this PR.

I will review the implementation today and merge if ok. Thanks for the investigation it's good to see you ran into exactly the same issues I had 😄