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

Send timezone offset as string instead of integer #2636

Merged
merged 1 commit into from
May 15, 2023

Conversation

ludoboludo
Copy link
Contributor

@ludoboludo ludoboludo commented May 12, 2023

PR Summary:

This fixes an issue when sending timezone offset as negative integer. This change ensures the offset is sent as string which avoid the cart add issue for gift cards with recipient.

Why are these changes introduced?

The cart serialization of line item properties with negative integer does not work. Using a string instead works.

The latest version of recipient form sends a new line item property __shopify_offset which can be a negative number (based on the customer timezone). When its negative, request to add gift card to the cart will fail (cart serialization code doesnt accept negative number)

What approach did you take?

Casting.

Visual impact on existing themes

Hide whitespace when checking the files changed

No visual impact.

Checklist

this.messageInput = this.querySelector(`#Recipient-message-${this.dataset.sectionId}`);
this.sendonInput = this.querySelector(`#Recipient-send-on-${this.dataset.sectionId}`);
this.offsetProperty = this.querySelector(`#Recipient-timezone-offset-${this.dataset.sectionId}`);
if (this.offsetProperty) this.offsetProperty.value = new Date().getTimezoneOffset().toString();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Original comment from @fredma :

The backend already casts the property to int if its a string, so this is safe.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ludoboludo I think the original change was only this line, but the whole file seems to be changed 🤔

https://github.com/Shopify/dawn/pull/2633/files#diff-b155c49124449ce256c03e05ec95dc95b232976c969766f023e30278c1833210L14

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah formatting happened. I don't think Fred was using the prettier settings we do. So if you hide the whitespace while reviewing there should not be any change affecting the rest of the code:

Copy link
Contributor

Choose a reason for hiding this comment

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

I still see a lot of other lines being affected. Is that expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you share a screenshot of what you're seeing ?
From my side it's just different formatting, spacing, semi colons, parentheses, etc. And that change with .toString()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It wasn't formatted on main though I think. It's code that's been added by folks from another team and I don't think they were using prettier the way we do. 🤷

We could confirm by having you go or other devs into that file from /main and save.

Copy link
Contributor

Choose a reason for hiding this comment

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

I dont see all the changes when I save it 🤔 but maybe i have different settings?

(how customElements .define line went to a different line) : https://screenshot.click/12-31-y8gnz-tgjux.mp4

Copy link
Contributor

@kmeleta kmeleta May 12, 2023

Choose a reason for hiding this comment

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

I dont see all the changes when I save it 🤔 but maybe i have different settings? (how customElements .define line went to a different line

When I prettify this file (outside this PR) I get the same type of formatting seen here. I'm not 100% but I think prettier in its default state tends to break complex arguments like an anon function, or in this case a class definition, into their own lines even if the line was within our defined print width of 120. So this is expected as far as I can tell.

Sofia, we can pair to see if/why your editor isn't using the same formatting as ours. Being a new addition, we've definitely had some cases of it not taking effect and instead using your existing editor/workspace preferences. Quitting vscode usually fixes it though. Either way, I wouldn't treat the formatting as a blocker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The formatting in settings.json should be like this:

Source

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! Mystery solved 😅 thanks Ludo! Definitely not a blocker - agreed

@melissaperreault melissaperreault self-requested a review May 12, 2023 19:06
@LucasLacerdaUX LucasLacerdaUX self-requested a review May 12, 2023 20:23
@LucasLacerdaUX
Copy link
Contributor

@ludoboludo Code looks good. How do we test this?

@fredma
Copy link
Contributor

fredma commented May 12, 2023

@LucasLacerdaUX

How do we test this?

I recorded a video if that helps.

Just to clarify, the casting in itself does not make a difference since the payload is built using FormData which already convert values to string. However, the change here really serves a documenting role and makes it explicit that the offset should only be sent as string. Some customized themes may send the payload as JSON which allows integer type.

@melissaperreault melissaperreault removed their request for review May 15, 2023 15:23
@ludoboludo ludoboludo merged commit 4d41abb into release/10.0.0 May 15, 2023
5 checks passed
@ludoboludo ludoboludo deleted the gift_cards/send_timezone branch May 15, 2023 15:58
ludoboludo added a commit that referenced this pull request Jun 6, 2023
* Fix color for image in password (#2608)

* [Image behavior] fixed background jitter fix on mobile (#2611)

* [Animation in editor] Remove transform translate when re rendering and re ordering blocks (#2614)

* Remove transform translate when re rendering and re ordering blocks

* target only what's needed

* [bug] Horizontal scrolling on mobile.  (#2617)

* Add overflow-x:hidden to prevent horizontal scrolling on mobile.

* Change margin for slider for mobile and tablet.

* Remove redundant preconnect to cdn.shopify.com (#2621)

* Update reverse scheme (#2626)

* [Footer] Remove Global Media settings inheritance from images (#2631)

* Send timezone offset as string instead of integer (#2636)

* Fix slider scrolling issue (#2635)

* Fix background gradient for Related Products. (#2641)

* Update from Shopify for theme dawn/release/10.0.0

Committed from shop: Skeleton Theme

* Quick add remove animation from image and content (#2657)

* Add default values for color scheme group (#2660)

* Revert unwanted changes (#2669)

* Update from Shopify for theme dawn/release/10.0.0

Committed from shop: Skeleton Theme

* Revert "Update from Shopify for theme dawn/release/10.0.0"

This reverts commit 89d927e.

* Remove forced white text color in Image Banner & Slideshow (#2663)

* Remove forced white color.

* Change color scheme for Dawn's default homepage Image Banner..

* Remove warning about color scheme usage.

* Fix bug with transparent buttons on mobile.

* Remove unused info key from translated files.

* Update display of button when it's in a mobile container.

* Update existing placeholder images (#2610)

* Update existing placeholder images

* Featured collection and product card

* Featured product section

* Collection list section

* Featured blog and multirow sections

* Slideshow: change order of placeholder images

* Collage adjustments for product and collection cards

* Image with text adjustments

* Featured product: re-add `.product--no-media` selectors

* Update featured product section

* Update `card-collection`

* Cleanup `card-collection`

---------

Co-authored-by: Ludo <ludo.segura@shopify.com>

* Gradient fix for transparent background medias and cards (#2651)

* Fix media, product, and collection cards placeholder (#2682)

* Fix missing else for collection cards (#2692)

---------

Co-authored-by: Sofia Matulis <sofiamatulis@users.noreply.github.com>
Co-authored-by: Eugene Kasimov <105315663+eugenekasimov@users.noreply.github.com>
Co-authored-by: Mateusz Krzeszowiak <mateusz.krzeszowiak@shopify.com>
Co-authored-by: Lucas Lacerda <37168033+LucasLacerdaUX@users.noreply.github.com>
Co-authored-by: Kjell Reigstad <kjell@kjellr.com>
Co-authored-by: shopify[bot] <79544226+shopify[bot]@users.noreply.github.com>
Co-authored-by: Ken Meleta <30790058+kmeleta@users.noreply.github.com>
Co-authored-by: Andrew Etchen <andrew.etchen@shopify.com>
lougoncharenko pushed a commit that referenced this pull request Jun 7, 2023
* Fix color for image in password (#2608)

* [Image behavior] fixed background jitter fix on mobile (#2611)

* [Animation in editor] Remove transform translate when re rendering and re ordering blocks (#2614)

* Remove transform translate when re rendering and re ordering blocks

* target only what's needed

* [bug] Horizontal scrolling on mobile.  (#2617)

* Add overflow-x:hidden to prevent horizontal scrolling on mobile.

* Change margin for slider for mobile and tablet.

* Remove redundant preconnect to cdn.shopify.com (#2621)

* Update reverse scheme (#2626)

* [Footer] Remove Global Media settings inheritance from images (#2631)

* Send timezone offset as string instead of integer (#2636)

* Fix slider scrolling issue (#2635)

* Fix background gradient for Related Products. (#2641)

* Update from Shopify for theme dawn/release/10.0.0

Committed from shop: Skeleton Theme

* Quick add remove animation from image and content (#2657)

* Add default values for color scheme group (#2660)

* Revert unwanted changes (#2669)

* Update from Shopify for theme dawn/release/10.0.0

Committed from shop: Skeleton Theme

* Revert "Update from Shopify for theme dawn/release/10.0.0"

This reverts commit 89d927e.

* Remove forced white text color in Image Banner & Slideshow (#2663)

* Remove forced white color.

* Change color scheme for Dawn's default homepage Image Banner..

* Remove warning about color scheme usage.

* Fix bug with transparent buttons on mobile.

* Remove unused info key from translated files.

* Update display of button when it's in a mobile container.

* Update existing placeholder images (#2610)

* Update existing placeholder images

* Featured collection and product card

* Featured product section

* Collection list section

* Featured blog and multirow sections

* Slideshow: change order of placeholder images

* Collage adjustments for product and collection cards

* Image with text adjustments

* Featured product: re-add `.product--no-media` selectors

* Update featured product section

* Update `card-collection`

* Cleanup `card-collection`

---------

Co-authored-by: Ludo <ludo.segura@shopify.com>

* Gradient fix for transparent background medias and cards (#2651)

* Fix media, product, and collection cards placeholder (#2682)

* Fix missing else for collection cards (#2692)

---------

Co-authored-by: Sofia Matulis <sofiamatulis@users.noreply.github.com>
Co-authored-by: Eugene Kasimov <105315663+eugenekasimov@users.noreply.github.com>
Co-authored-by: Mateusz Krzeszowiak <mateusz.krzeszowiak@shopify.com>
Co-authored-by: Lucas Lacerda <37168033+LucasLacerdaUX@users.noreply.github.com>
Co-authored-by: Kjell Reigstad <kjell@kjellr.com>
Co-authored-by: shopify[bot] <79544226+shopify[bot]@users.noreply.github.com>
Co-authored-by: Ken Meleta <30790058+kmeleta@users.noreply.github.com>
Co-authored-by: Andrew Etchen <andrew.etchen@shopify.com>
lougoncharenko added a commit that referenced this pull request Jun 21, 2023
* made the test/default blog post 3 by default

* blog default posts are not mobile responsive and on a slider. created snippet for blog-placeholder that renders into featured-blog with changable arguments

* removed commented out code

* default blog posts now are modifiable by post-limit and column number presets

* reformated code, reverted header back to h1, removed snippet, and made changes as suggested

* noticed the blog section needs a margin bottom when color scheme is applied

* removed padding from blog and removed date and author presets

* Fix link formatting in Related Products heading (#2680)

* fix default UI for dropdown and mega menu (#2644)

* added vertical padding and made l2 bold to mega menu

* added vertical padding to drop down

* fixed default UI for dropdown and mega menu

* added hover effect to all l2 links and fixed overlapping or mega menu

* adding padding to l3 links and fixed hover effect for dropdown

* reverted the mega menu back to the current setting

* changed horizontal grid gap on mega menu and vertical paddings on dropdown menu

* made vertical grid gap at 1.8 rem to match the 3 rem vertical paddings on mega-menu container

* removed the unnecessary lines of code

* removed the text-thickness that was making l2/l3 links a different size from l1 links

* added a hover effect over active link

* removed uneccessary link size and white space

* Add release/v10.0.0 branch fixes to main (#2693)

* Fix color for image in password (#2608)

* [Image behavior] fixed background jitter fix on mobile (#2611)

* [Animation in editor] Remove transform translate when re rendering and re ordering blocks (#2614)

* Remove transform translate when re rendering and re ordering blocks

* target only what's needed

* [bug] Horizontal scrolling on mobile.  (#2617)

* Add overflow-x:hidden to prevent horizontal scrolling on mobile.

* Change margin for slider for mobile and tablet.

* Remove redundant preconnect to cdn.shopify.com (#2621)

* Update reverse scheme (#2626)

* [Footer] Remove Global Media settings inheritance from images (#2631)

* Send timezone offset as string instead of integer (#2636)

* Fix slider scrolling issue (#2635)

* Fix background gradient for Related Products. (#2641)

* Update from Shopify for theme dawn/release/10.0.0

Committed from shop: Skeleton Theme

* Quick add remove animation from image and content (#2657)

* Add default values for color scheme group (#2660)

* Revert unwanted changes (#2669)

* Update from Shopify for theme dawn/release/10.0.0

Committed from shop: Skeleton Theme

* Revert "Update from Shopify for theme dawn/release/10.0.0"

This reverts commit 89d927e.

* Remove forced white text color in Image Banner & Slideshow (#2663)

* Remove forced white color.

* Change color scheme for Dawn's default homepage Image Banner..

* Remove warning about color scheme usage.

* Fix bug with transparent buttons on mobile.

* Remove unused info key from translated files.

* Update display of button when it's in a mobile container.

* Update existing placeholder images (#2610)

* Update existing placeholder images

* Featured collection and product card

* Featured product section

* Collection list section

* Featured blog and multirow sections

* Slideshow: change order of placeholder images

* Collage adjustments for product and collection cards

* Image with text adjustments

* Featured product: re-add `.product--no-media` selectors

* Update featured product section

* Update `card-collection`

* Cleanup `card-collection`

---------

Co-authored-by: Ludo <ludo.segura@shopify.com>

* Gradient fix for transparent background medias and cards (#2651)

* Fix media, product, and collection cards placeholder (#2682)

* Fix missing else for collection cards (#2692)

---------

Co-authored-by: Sofia Matulis <sofiamatulis@users.noreply.github.com>
Co-authored-by: Eugene Kasimov <105315663+eugenekasimov@users.noreply.github.com>
Co-authored-by: Mateusz Krzeszowiak <mateusz.krzeszowiak@shopify.com>
Co-authored-by: Lucas Lacerda <37168033+LucasLacerdaUX@users.noreply.github.com>
Co-authored-by: Kjell Reigstad <kjell@kjellr.com>
Co-authored-by: shopify[bot] <79544226+shopify[bot]@users.noreply.github.com>
Co-authored-by: Ken Meleta <30790058+kmeleta@users.noreply.github.com>
Co-authored-by: Andrew Etchen <andrew.etchen@shopify.com>

* made the test/default blog post 3 by default

* added updated placeholder image

* added the different placeholder images, while maintaining ability to edit with presets

* blog card theme settings work on default blog posts

* removed css that wasn't being used

* reverted to original code without theme settings

* fixed prettier error by removing extra quotation mark and made test blog default instead of news

---------

Co-authored-by: Jon Neill <jonathan.neill@shopify.com>
Co-authored-by: Ludo <ludo.segura@shopify.com>
Co-authored-by: Sofia Matulis <sofiamatulis@users.noreply.github.com>
Co-authored-by: Eugene Kasimov <105315663+eugenekasimov@users.noreply.github.com>
Co-authored-by: Mateusz Krzeszowiak <mateusz.krzeszowiak@shopify.com>
Co-authored-by: Lucas Lacerda <37168033+LucasLacerdaUX@users.noreply.github.com>
Co-authored-by: Kjell Reigstad <kjell@kjellr.com>
Co-authored-by: shopify[bot] <79544226+shopify[bot]@users.noreply.github.com>
Co-authored-by: Ken Meleta <30790058+kmeleta@users.noreply.github.com>
Co-authored-by: Andrew Etchen <andrew.etchen@shopify.com>
SmolSoftBoi pushed a commit to m-k-enterprises/dawn that referenced this pull request Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants