From c1917318ca2c998dedc3f724f1df4676e45a152b Mon Sep 17 00:00:00 2001 From: Sorin Davidoi Date: Sun, 28 Oct 2018 22:28:55 +0000 Subject: [PATCH] fix: Show boost action only for toots with relevant visibility (#584) --- templates/service-worker.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/templates/service-worker.js b/templates/service-worker.js index efced8b..928476e 100644 --- a/templates/service-worker.js +++ b/templates/service-worker.js @@ -138,9 +138,6 @@ async function showRichNotification (data, notification) { const actions = [{ action: 'favourite', title: 'Favourite' - }, { - action: 'reblog', - title: 'Boost' }] if ('reply' in NotificationEvent.prototype) { @@ -151,6 +148,13 @@ async function showRichNotification (data, notification) { }) } + if (['public', 'unlisted'].includes(notification.status.visibility)) { + actions.push({ + action: 'reblog', + title: 'Boost' + }) + } + await self.registration.showNotification(data.title, { icon: data.icon, body: data.body,