Support for sticky items, basic article content in the item payload#3222
Open
IvanJelicSF wants to merge 7 commits into
Conversation
…elop-sticky Feature/content lists with develop sticky
…elop-article-data Adding article info to the list items response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds three related capabilities to the content-lists bulk-patch flow:
move. Themoveaction now reads and writes thestickyfield, so items can be pinned or unpinned in the same call that repositions them. Whenstickyis omitted the existing value is preserved./content_lists/<id>/itemsare enriched with anarticle_contentobject (title,state,thumbnail) for every item. The thumbnail prefers the feature-mediathumbnailrendition and falls back to the first<img>inbody_html._renumberstep runs after each bulk patch and re-assigns positions so that every item has a unique slot. Sticky items and items touched by the current batch (add/move) anchor at their declared position; untouched non-sticky items fill the lowest free slots in their previous order. If two anchors collide, sticky wins, then the most recently touched within a group, with the loser spilling to the next free slot.Files changed
apps/content_lists/article_content.pyattach_article_content,enrich_fetched_response,enrich_fetched_item) and thumbnail extraction.apps/content_lists/rest_endpoints.pyon_fetched/on_fetched_itemto the new enrichment hooks.apps/content_lists/service.pymovereads/writessticky; tracks touched items; calls new_renumberto keep positions unique via a single bulkUpdateOnewrite.features/content_lists.featureDiffstat: 4 files changed, 397 insertions(+), 2 deletions(-)
Commits
97ce1273Update positions of other items affected by moving/adding/removing9cc14271Adding article info to the list items response2b9acd71Enable sticky read/write for the move action55520b25Sync enable sticky read/write for the move action with latest changes1f19b058Merge PR fixed setup.py, removed source folder #1 (sticky)106a75d8Merge PR [SD-3031] Updates of images from Reuters causes media entries to beco… #2 (article data)4fc2e2ddKeep list positions unique by anchoring sticky and moved itemsBehaviour notes
_renumberis a no-op when nothing needs to change — only positions that actually shift are written, via a singlebulk_write(ordered=False).movewithout an explicitstickykeeps the previous value (verified byMove action preserves sticky flag when not provided).article_contentisNonefor items whose archive document cannot be found, so the field is always present in responses.parse_htmlfailures degrade silently toNone.Test plan
features/content_lists.feature— all six new scenarios should pass alongside the existing ones.GET /content_lists/<id>/itemsreturnsarticle_contentfor items whose archive document exists, andnullotherwise.movewithsticky: truepins an item; subsequentmovewithsticky: falseunpins it.0.Resolves: SDESK-7929 SDESK-7935