show who boosted content in feed - #2210
blued-gear wants to merge 13 commits into
Conversation
|
For the API, we could modify the existing end points to accept an |
|
@jwr1’s API point is still outstanding. The combined collection endpoints already expose an Let me try to add this directly here, while I'm at it.. So I will extend the PR with the requested API extention. |
|
Implemented the API portion in 3dd16f9. The existing |
|
I changed the |
| } | ||
|
|
||
| $item = ['user' => $user, 'time' => new \DateTimeImmutable($row['created_at'])]; | ||
| $boostExtensions[$row['item_id']][] = &$item; |
There was a problem hiding this comment.
Each element added here references the same loop-local $item variable. On the next iteration, assigning a new array to $item changes every previously stored element as well, so two boost rows of the same content type become duplicate copies of the final row (and itemsToFix has the same alias). Please store distinct values/indices instead of references and add a test with at least two boost rows in one type, ideally from different users or for different content IDs.
| } | ||
| } | ||
|
|
||
| foreach ($boostExtensions as $boosts) { |
There was a problem hiding this comment.
This sorts only the copied $boosts array, so the reordered value is discarded at the end of each iteration and the returned boost lists retain the database's unspecified row order. The previous implementation explicitly returned boosts ordered by time, which also determines which users survive the five-item template limit. Please iterate by reference or assign the sorted array back, and cover the ordering with more than one boost row.
There was a problem hiding this comment.
As a sidenote: who in the right mind put in the PHP specification that arrays are always passed by value?!
…r' into new/combined_page-show_boost_user
If content gets included in the feed (Combined + Subscribed + Newest), then show who of the followees boosted it.

This is currently only for the UI. If you have an idea how this info can be included in API responses, please let me know (@jwr1).
As the content-query can become white heavy when including comments, this PR also adds a setting for the admins to disable comments in the feed.
Closes #2192