Skip to content

Commit 68db9e2

Browse files
authored
fix: notifications to respect add to cart config (#3229)
1 parent d02ae7f commit 68db9e2

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/messaging/pushover.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export function sendPushoverNotification(link: Link, store: Store) {
1717
const message: PushoverMessage =
1818
pushover.priority < 2
1919
? {
20-
message: link.cartUrl ? link.cartUrl : link.url,
20+
message:
21+
link.cartUrl && config.store.autoAddToCart
22+
? link.cartUrl
23+
: link.url,
2124
priority: pushover.priority,
2225
sound: pushover.sound,
2326
title: Print.inStock(link, store),
@@ -26,7 +29,10 @@ export function sendPushoverNotification(link: Link, store: Store) {
2629
}
2730
: {
2831
expire: pushover.expire,
29-
message: link.cartUrl ? link.cartUrl : link.url,
32+
message:
33+
link.cartUrl && config.store.autoAddToCart
34+
? link.cartUrl
35+
: link.url,
3036
priority: pushover.priority,
3137
sound: pushover.sound,
3238
retry: pushover.retry,

src/messaging/twilio.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export function sendTwilioMessage(link: Link, store: Store) {
1515
logger.debug('↗ sending twilio message');
1616

1717
(async () => {
18-
const givenUrl = link.cartUrl ? link.cartUrl : link.url;
18+
const givenUrl =
19+
link.cartUrl && config.store.autoAddToCart ? link.cartUrl : link.url;
1920
const message = `${Print.inStock(link, store)}\n${givenUrl}`;
2021
const numbers = twilio.to.split(',');
2122
const results = [];

0 commit comments

Comments
 (0)