-
Notifications
You must be signed in to change notification settings - Fork 226
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
Bug 1897319 - Stores icons for light/dark theme for Yelp suggestion #6248
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6248 +/- ##
=======================================
Coverage 50.85% 50.85%
=======================================
Files 112 112
Lines 11811 11811
=======================================
Hits 6006 6006
Misses 5805 5805 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Daisuke, r+ with comments -- especially, the schema version needs to be bumped and a migration step added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to bump the schema VERSION
const and add a migration step to upgrade_from()
. See the comment above VERSION
.
components/suggest/src/store.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating all these tests, I know it's pain.
It looks like we now have tests for Yelp suggestions with both light and dark icons, but no tests for only one or the other. Also we may want to keep including icon
in the RS data in order to support older Firefox versions for some time, and I want to make sure that doesn't break newer versions.
So could you add cases for the following please, in whatever way is easiest? In all cases, ingest and fetch should complete successfully.
- Only
iconLightTheme
is present in the RS data - Only
iconDarkTheme
is present icon
,iconLightTheme
, andiconDarkTheme
are all present (icon
should be ignored and ingest and fetch should still be successful)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Thanks!
icon_light_theme_id TEXT NOT NULL, | ||
icon_dark_theme_id TEXT NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storing both light and dark icons in the same row is OK with me, and also I just wanted to mention another way to do it would be to have one icon per row plus an "icon type" column. If we need to support any more types of icons in the future -- and I don't know why we would! -- I think we should switch to that approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, if we do not know how many icons we should handle, then yeah, should introduce the mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it looks like there are merge conflicts in lib.rs and store.rs, plus some failing tests. Could you fix those and make sure cargo test -p suggest
passes locally for you?
components/suggest/src/schema.rs
Outdated
@@ -193,6 +195,11 @@ CREATE TABLE IF NOT EXISTS dismissed_suggestions ( | |||
)?; | |||
Ok(()) | |||
} | |||
19 => { | |||
// Need to update new icons for Yelp especially in new schema. | |||
let _ = clear_database(tx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since only the Yelp table changed, can we do something like this instead?
- If
yelp_custom_details
exists, get the current record fromyelp_custom_details
and thenDROP TABLE yelp_custom_details
CREATE TABLE yelp_custom_details
just like in the main schema SQL- If we got the record from the old table in step 1, insert it into the new table, using the old
icon_id
as the newicon_light_theme_id
Starting with schema version 16, I believe the idea is to avoid clearing the entire DB on upgrade if possible.
Sorry to add more work but It would also be nice if you could add a test for this migration step too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks!
Hi @0c0w3! As I changed more places than I expected, I'd like to request review from you again. Thanks! |
Hey @dadaa, Emilio's idea of choosing the appropriate image in the svg itself is really nice, and it means we don't need to modify the schema at all. I'm sorry for not thinking of that, and for all the work you've done in this PR that we might not need. If you remove the schema change from this PR, it's basically the same as #6162, right? |
Yeah, indeed. I'm also sorry to you that I took your time due to I could not come up with it.
Yes! So, I will close this PR when the bug is fixed. |
But, I was a little concerned about whether it would be okay to change the official logo file, even though it would look the same. |
I think it's OK to create a new file that combines both official files as long as we don't modify any strokes or colors. My example file in Phabricator embeded only the |
We took another approach, let me close this PR. |
Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1897319
Jira: https://mozilla-hub.atlassian.net/browse/SNG-1515
We need to update the UI for Yelp suggestion.
One of them is to chnage the logo. But it has to change by the light/dark theme. Thus, make it to store both icons.
This PR did two things.
Pull Request checklist
[ci full]
to the PR title.Branch builds: add
[firefox-android: branch-name]
to the PR title.