Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Enable favorite shots on My Shots #4984

Merged
merged 1 commit into from
Oct 4, 2018

Conversation

chenba
Copy link
Collaborator

@chenba chenba commented Oct 2, 2018

Fixes #4934

@chenba chenba requested a review from flodolo as a code owner October 2, 2018 23:10
@@ -315,6 +315,7 @@ shotIndexFavoriteIcon =
.title = This is a favorite shot and it does not expire
shotIndexSyncedShot =
.title = Shot taken on another device
shotIndexAlertErrorFavoriteShot = Error updating favorite shot status
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure about this message. Perhaps @johngruen can advise. It's similar to the one on the shot page. (That one probably should be updated?) It's used for favorite and un-favorite actions.

ianb
ianb previously requested changes Oct 3, 2018
Copy link
Contributor

@ianb ianb left a comment

Choose a reason for hiding this comment

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

A couple small notes


onClickFavorite(shot) {
controller.toggleFavoriteShot(shot);
sendEvent("favorite", "myshots-tile");
Copy link
Contributor

Choose a reason for hiding this comment

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

METRICS.md should be updated with this event

if (!resp.ok) {
window.Raven.captureException(
new Error(`Error calling /api/set-expiration: ${resp.status} ${resp.statusText}`));
throw new Error();
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually I do: let exc = new Error(...); window.Raven.captureException(exc); throw exc;

@@ -148,6 +148,9 @@ class Body extends React.Component {
renderErrorMessages() {
return (
<div>
<Localized id="">
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do the other Localized's have ids and this one doesn't?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

D'oh! I deleted the id of some pasted code but didn't insert the new one.

} catch (err) {
// The error could be one from the server or a network level error from
// fetch; we display a generic message either way as it's (probably?)
// friendlier than percolating a fetch error message up to the user.
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably good to do console.warn("Error updating expiration:", err); so it isn't entirely swallowed

@chenba chenba dismissed ianb’s stale review October 3, 2018 18:41

Made changes based the feedback. Thanks!

@chenba chenba force-pushed the 4934-fav-myshots branch 2 times, most recently from 166466d to 57e7a3e Compare October 3, 2018 18:46
@@ -328,6 +328,8 @@ These are events that an add-on user can encounter on a shot they own
6. [x] Right-click (or get the context menu) anywhere on the page `contextmenu/background`, `contextmenu/shot-tile`, `contextmenu/search`, or `contextmenu/header` depending on where the user clicks.
7. [x] Click download from tile: `web/download/myshots-tile`
8. [x] Clear search with button: `web/clear-search/button`
8. [x] Click to favorite: `web/favorite/myshots-tile`
8. [x] Click to un-favorite: `web/unfavorite/myshots-tile`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is new since the previous review. Now it track seting and unsetting a shot as a favorite with separate events.

@@ -463,6 +468,16 @@ class Card extends React.Component {
this.downloadButton.blur();
sendEvent("download", "myshots-tile");
}

onClickFavorite(shot) {
if (shot.isFavorite) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

isFavorite is set on each shot after it's instantiated from the JSON data and updated in toggleFavoriteShot. Could consider changing it to a function in shot that returns a bool based on expiration, similar to what was done for isOwner.

@ianb ianb merged commit eaeedfb into mozilla-services:master Oct 4, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants