Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Filter out disliked artworks on artworks rail #11366

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

olerichter00
Copy link
Contributor

@olerichter00 olerichter00 commented Jan 9, 2025

This PR resolves ONYX-1480

Description

It's possible to dislike/hide artworks on the home screen's "New Works for You" rail, but currently, the artworks show up again after reopening the app.

In order to always filter out disliked artworks on the "New Works for You" rail, we need to filter artworks using the isDisliked field, which hasn't been implemented for the rail. This PR adds the filter.

In addition to that this PR removes the "Save" item from the context menu from all artwork cards and not only for the "New Works for You" rail.

simulator_screenshot_8404413B-E093-4B9E-A275-80C94F20AE5D

PR Checklist

  • I have tested my changes on iOS and Android.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

  • Filter out disliked artworks (by tapping "Not Interested" on the long-press context menu) on the home screen's "New Works for You" rail correctly - ole
  • Remove "Save" item from artwork long-press context menu - ole

iOS user-facing changes

Android user-facing changes

Dev changes

Need help with something? Have a look at our docs, or get in touch with us.

@artsy-peril
Copy link
Contributor

artsy-peril bot commented Jan 9, 2025

Warnings
⚠️ Please assign someone to merge this PR, and optionally include people who should review.

Generated by 🚫 dangerJS against d66e7dd

@ArtsyOpenSource
Copy link
Contributor

Warnings
⚠️

An error occurred while validating your changelog, please make sure you provided a valid changelog.

Generated by 🚫 dangerJS against d66e7dd

@@ -155,21 +141,6 @@ export const ContextMenuArtwork: React.FC<ContextMenuArtworkProps> = ({
},
]

if (!enableSupressArtwork) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for sneaking this change into the PR... The "Save" or "Watch Lot" action should be removed from the context menu because they are already present on all artwork rail and grid cards.

Slack thread with request for deleting the item: https://artsy.slack.com/archives/C05EQL4R5N0/p1715340751240539

simulator_screenshot_4190F5AF-F883-4CD8-9A6A-E1C083F5FADD

Copy link
Member

@MounirDhahri MounirDhahri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. I would also consider doing this filtering from the backend and potentially supporting it within the filterArtworksConnection. I know this might mean we need changes to MP and Gravity but it might be worth it.
If you already considered that, don't mind my comment. The code looks good to me

let artworks = extractNodes(section.artworksConnection)

if (isDislikeArtworksEnabled(section.contextModule)) {
artworks = artworks.filter((artwork) => !artwork.isDisliked)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filtering disliked artworks from the rail might break pagination if the last artwork is a disliked one. Because we would query the 2nd page using the last node (which will be the last non disliked artwork).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's fine, here because the worst that can happen is we return a list that's shorter than 10. and this only breaks if one dislikes all last 10 artworks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! We need to make sure pagination is still working when filtering out the artworks after fetching the data.

I assumed this may lead to smaller pages but would not break pagination 🤞 However, I haven't tested it yet, especially considering the case where the last artwork on a page was disliked. I'll do some more testing before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants