Skip to content

Commit baf1e8f

Browse files
committed
Fix b/232072111
1 parent f84cacd commit baf1e8f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/messaging/src/helpers/externalizePayload.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ describe('externalizePayload', () => {
2626
notification: {
2727
title: 'title',
2828
body: 'body',
29-
image: 'image'
29+
image: 'image',
30+
click_action: "https://www.self_orgin.com",
3031
},
3132
from: 'from',
3233
// eslint-disable-next-line camelcase
@@ -39,7 +40,10 @@ describe('externalizePayload', () => {
3940
notification: { title: 'title', body: 'body', image: 'image' },
4041
from: 'from',
4142
collapseKey: 'collapse',
42-
messageId: 'mid'
43+
messageId: 'mid',
44+
fcmOptions: {
45+
link: "https://www.self_orgin.com"
46+
},
4347
};
4448
expect(externalizePayload(internalPayload)).to.deep.equal(payload);
4549
});
@@ -62,7 +66,8 @@ describe('externalizePayload', () => {
6266
data: { foo: 'foo', bar: 'bar', baz: 'baz' },
6367
from: 'from',
6468
collapseKey: 'collapse',
65-
messageId: 'mid'
69+
messageId: 'mid',
70+
6671
};
6772
expect(externalizePayload(internalPayload)).to.deep.equal(payload);
6873
});

packages/messaging/src/helpers/externalizePayload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function propagateFcmOptions(
8383

8484
payload.fcmOptions = {};
8585

86-
const link = messagePayloadInternal.fcmOptions!.link;
86+
const link = messagePayloadInternal.fcmOptions?.link ?? messagePayloadInternal.notification?.click_action;
8787
if (!!link) {
8888
payload.fcmOptions!.link = link;
8989
}

0 commit comments

Comments
 (0)