Skip to content
Merged
Changes from 1 commit
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
12 changes: 4 additions & 8 deletions src/dashboard/Push/PushIndex.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,11 @@ let getPushName = (pushData) => {
);
} else {
let payload = pushData[PushConstants.PAYLOAD_FIELD];
Copy link
Contributor

@peterdotjs peterdotjs Jun 24, 2016

Choose a reason for hiding this comment

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

You could just change this line to: let payload = pushData[PushConstants.PAYLOAD_FIELD] || '';

This should achieve what you are looking for. While keeping the existing alert type checks in place.

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;
if(payload) {
let payloadJSON = JSON.parse(payload);
return payloadJSON.alert ? payloadJSON.alert : payload;
}
return '';
}
}

Expand Down