fix: various push notification fixes (#1245)

This commit is contained in:
Nolan Lawson 2019-05-27 14:01:02 -07:00 committed by GitHub
parent 164768e6c9
commit 3a2c56f0fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View file

@ -162,13 +162,15 @@ async function showRichNotification (data, notification) {
case 'mention':
const isPublic = ['public', 'unlisted'].includes(notification.status.visibility)
const actions = [
{
action: 'favourite',
title: 'Favorite'
},
isPublic && {
action: 'reblog',
icon: '/icon-push-fa-retweet.png', // generated manually from font-awesome-svg
title: 'Boost'
},
{
action: 'favourite',
icon: '/icon-push-fa-star.png', // generated manually from font-awesome-svg
title: 'Favorite'
}
].filter(Boolean)
@ -191,10 +193,12 @@ async function showRichNotification (data, notification) {
const cloneNotification = notification => {
const clone = {}
// Object.assign() does not work with notifications
for (let k in notification) {
// intentionally not doing a hasOwnProperty check
clone[k] = notification[k]
// deliberately not doing a hasOwnProperty check, but skipping
// functions and null props like onclick and onshow and showTrigger
if (typeof notification[k] !== 'function' && notification[k] !== null) {
clone[k] = notification[k]
}
}
return clone

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B