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': case 'mention':
const isPublic = ['public', 'unlisted'].includes(notification.status.visibility) const isPublic = ['public', 'unlisted'].includes(notification.status.visibility)
const actions = [ const actions = [
{
action: 'favourite',
title: 'Favorite'
},
isPublic && { isPublic && {
action: 'reblog', action: 'reblog',
icon: '/icon-push-fa-retweet.png', // generated manually from font-awesome-svg
title: 'Boost' title: 'Boost'
},
{
action: 'favourite',
icon: '/icon-push-fa-star.png', // generated manually from font-awesome-svg
title: 'Favorite'
} }
].filter(Boolean) ].filter(Boolean)
@ -191,11 +193,13 @@ async function showRichNotification (data, notification) {
const cloneNotification = notification => { const cloneNotification = notification => {
const clone = {} const clone = {}
// Object.assign() does not work with notifications
for (let k in notification) { for (let k in notification) {
// intentionally not doing a hasOwnProperty check // 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] clone[k] = notification[k]
} }
}
return clone return clone
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B