@ -1,6 +1,6 @@
import IntlMessageFormat from 'intl-messageformat' ;
import IntlMessageFormat from 'intl-messageformat' ;
import locales from './web_push_locales' ;
import { unescape } from 'lodash' ;
import { unescape } from 'lodash' ;
import locales from './web_push_locales' ;
const MAX _NOTIFICATIONS = 5 ;
const MAX _NOTIFICATIONS = 5 ;
const GROUP _TAG = 'tag' ;
const GROUP _TAG = 'tag' ;
@ -90,7 +90,13 @@ export const handlePush = (event) => {
options . tag = notification . id ;
options . tag = notification . id ;
options . badge = '/badge.png' ;
options . badge = '/badge.png' ;
options . image = notification . status && notification . status . media _attachments . length > 0 && notification . status . media _attachments [ 0 ] . preview _url || undefined ;
options . image = notification . status && notification . status . media _attachments . length > 0 && notification . status . media _attachments [ 0 ] . preview _url || undefined ;
options . data = { access _token , preferred _locale , id : notification . status ? notification . status . id : notification . account . id , url : notification . status ? ` /@ ${ notification . account . acct } / ${ notification . status . id } ` : ` /@ ${ notification . account . acct } ` } ;
options . data = { access _token , preferred _locale , id : notification . status ? notification . status . id : notification . account . id } ;
if ( notification . status ) {
options . data . url = ` /@ ${ notification . status . account . acct } / ${ notification . status . id } ` ;
} else {
options . data . url = ` /@ ${ notification . account . acct } ` ;
}
if ( notification . status && notification . status . spoiler _text || notification . status . sensitive ) {
if ( notification . status && notification . status . spoiler _text || notification . status . sensitive ) {
options . data . hiddenBody = htmlToPlainText ( notification . status . content ) ;
options . data . hiddenBody = htmlToPlainText ( notification . status . content ) ;