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(notification): sms subject output #298

Merged
merged 5 commits into from Sep 26, 2020
Merged

fix(notification): sms subject output #298

merged 5 commits into from Sep 26, 2020

Conversation

ththiem
Copy link
Contributor

@ththiem ththiem commented Sep 25, 2020

Description

Best Buy test card is out of stock and wouldn't trigger tests, replaced with an in-stock card.

SMS messages were getting jumbled mess because of emojis in the subject line:
image

image

Removing them returns the subject line back to normal
image

I can only confirm this was affecting TMobile sms messages, but in lieu of adding lots of conditional logic to check for carriers individually the emojis should just go for compatibility.

@ththiem ththiem requested a review from jef as a code owner September 25, 2020 01:38
@ththiem
Copy link
Contributor Author

ththiem commented Sep 25, 2020

As an FYI, tmobile is blocking SMS messages with bestbuy.com links in them.

@joshuahiggins
Copy link
Contributor

Ahhh, I was wondering why my T-mobile SMS messages were failing. Good catch.

@@ -27,7 +27,7 @@ export function sendSMS(link: Link, store: Store) {
}
] : undefined,
from: email.username,
subject: Print.inStock(link, store),
subject: Print.inStock(link, store, false, true),
Copy link
Owner

Choose a reason for hiding this comment

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

Looks like I forgot to do the false here. My bad. I thought I tested that 😢

That being said, do you need to scrape the emojis as well? I don't really care, but does it not send otherwise?

Copy link
Owner

Choose a reason for hiding this comment

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

I think this is the only required change really. Just set this to

Suggested change
subject: Print.inStock(link, store, false, true),
subject: Print.inStock(link, store, false),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jef look at the signature of the inStock print function:

inStock(link: Link, store: Store, color?: boolean, sms?: boolean)

It's always had a 3rd parameter to enable color scheme for console output, which is default to undefined (false) in most places that have nothing to do with console output. It's an optional parameter. I added a 4th optional parameter to control removing the emoji's from non-console output. Only SMS subject line is currently affected by them, everywhere else can take emojis but no color (which is the default of both optional parameters). SMS subject line specifies false for color and true for removing emojis. Everywhere else does not

Copy link
Owner

@jef jef Sep 26, 2020

Choose a reason for hiding this comment

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

SMS subject line specifies false for color and true for removing emojis. Everywhere else does not

Right, I understand the change you're making. But I'm interested if we really need to scrape everything and add another parameter as opposed to updating the call and setting the color param to false.

Copy link
Owner

@jef jef Sep 26, 2020

Choose a reason for hiding this comment

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

Obviously color is going to screw up the SMS. That's why I introduced this logic in the first place, but I had mistakenly forgot to set the color to false for this statement.

That being said, do emojis not work?

Oddly enough, my SMS doesn't work as is, but can definitely see this being a problem.

Copy link
Owner

Choose a reason for hiding this comment

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

I guess not for SMS.

Alright, I'll merge this one in. Thank you for the contribution!

@jef
Copy link
Owner

jef commented Sep 25, 2020

As an FYI, tmobile is blocking SMS messages with bestbuy.com links in them.

I'm pretty sure this is illegal. I'd be hard pressed to believe this to be the case.

@geman220 geman220 linked an issue Sep 25, 2020 that may be closed by this pull request
@@ -27,7 +27,7 @@ export function sendSMS(link: Link, store: Store) {
}
] : undefined,
from: email.username,
subject: Print.inStock(link, store),
subject: Print.inStock(link, store, false, true),
Copy link
Owner

Choose a reason for hiding this comment

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

I think this is the only required change really. Just set this to

Suggested change
subject: Print.inStock(link, store, false, true),
subject: Print.inStock(link, store, false),

@ththiem ththiem requested a review from jef September 26, 2020 06:55
@jef jef changed the title Fixes for SMS subject line and out of stock test cards in best buy fix(notification): sms subject output Sep 26, 2020
@jef jef merged commit 03755d5 into jef:main Sep 26, 2020
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.

Text Messages not working
3 participants