Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dashboard/Push/PushIndex.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ let getPushName = (pushData) => {
<strong>{title}</strong>
);
} else {
let payload = pushData[PushConstants.PAYLOAD_FIELD];
let payload = pushData[PushConstants.PAYLOAD_FIELD] || '';
try {
payload = JSON.parse(payload);
} catch(e) { }
if (payload) {
if (typeof payload.alert === 'string') {
return payload.alert;
}
return payload.alert ? JSON.stringify(payload.alert) : payload;
return payload.alert ? JSON.stringify(payload.alert) : JSON.stringify(payload);
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool! One nit is that when the payload is empty string JSON.stringify('') results in a double string outputted. We'll only need stringify if payload is an object. Once you've added that check its go to merge. Thanks!

}
}
}
Expand Down