Skip to content

Commit 6639aac

Browse files
ClearlyClairehiyuki2578
authored andcommitted
Hide CWed content in notifications and fix sensitive images without CWs (mastodon#9778)
Fixes mastodon#9634
1 parent b0bb3b2 commit 6639aac

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

app/javascript/mastodon/service_worker/web_push_notifications.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,14 @@ const handlePush = (event) => {
9292
options.image = notification.status && notification.status.media_attachments.length > 0 && notification.status.media_attachments[0].preview_url || undefined;
9393
options.data = { access_token, preferred_locale, id: notification.status ? notification.status.id : notification.account.id, url: notification.status ? `/web/statuses/${notification.status.id}` : `/web/accounts/${notification.account.id}` };
9494

95-
if (notification.status && notification.status.sensitive) {
95+
if (notification.status && notification.status.spoiler_text || notification.status.sensitive) {
9696
options.data.hiddenBody = htmlToPlainText(notification.status.content);
9797
options.data.hiddenImage = notification.status.media_attachments.length > 0 && notification.status.media_attachments[0].preview_url;
9898

99-
options.body = notification.status.spoiler_text;
99+
if (notification.status.spoiler_text) {
100+
options.body = notification.status.spoiler_text;
101+
}
102+
100103
options.image = undefined;
101104
options.actions = [actionExpand(preferred_locale)];
102105
} else if (notification.type === 'mention') {

0 commit comments

Comments
 (0)