From b1f0457cb815b145763485ec681aa52bd910c2bc Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 15 Nov 2023 12:40:52 +0100 Subject: [PATCH] Fix whitespace and comment discrepancies --- app/javascript/flavours/glitch/actions/notifications.js | 2 +- app/javascript/flavours/glitch/actions/streaming.js | 8 ++++---- app/javascript/flavours/glitch/utils/html.js | 1 + app/javascript/flavours/glitch/utils/icons.jsx | 2 ++ app/javascript/flavours/glitch/utils/notifications.js | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/javascript/flavours/glitch/actions/notifications.js b/app/javascript/flavours/glitch/actions/notifications.js index c31ac520ac..e98b843863 100644 --- a/app/javascript/flavours/glitch/actions/notifications.js +++ b/app/javascript/flavours/glitch/actions/notifications.js @@ -131,6 +131,7 @@ export function updateNotifications(notification, intlMessages, intlLocale) { const body = (notification.status && notification.status.spoiler_text.length > 0) ? notification.status.spoiler_text : unescapeHTML(notification.status ? notification.status.content : ''); const notify = new Notification(title, { body, icon: notification.account.avatar, tag: notification.id }); + notify.addEventListener('click', () => { window.focus(); notify.close(); @@ -141,7 +142,6 @@ export function updateNotifications(notification, intlMessages, intlLocale) { const excludeTypesFromSettings = state => state.getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS(); - const excludeTypesFromFilter = filter => { const allTypes = ImmutableList([ 'follow', diff --git a/app/javascript/flavours/glitch/actions/streaming.js b/app/javascript/flavours/glitch/actions/streaming.js index 9ae13a4716..d8341a5c16 100644 --- a/app/javascript/flavours/glitch/actions/streaming.js +++ b/app/javascript/flavours/glitch/actions/streaming.js @@ -67,8 +67,8 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti // @ts-expect-error if (pollingId) { - clearTimeout(pollingId); - pollingId = null; + // @ts-ignore + clearTimeout(pollingId); pollingId = null; } if (options.fillGaps) { @@ -85,8 +85,8 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti } }, - onReceive (data) { - switch(data.event) { + onReceive(data) { + switch (data.event) { case 'update': // @ts-expect-error dispatch(updateTimeline(timelineId, JSON.parse(data.payload), options.accept)); diff --git a/app/javascript/flavours/glitch/utils/html.js b/app/javascript/flavours/glitch/utils/html.js index 5159df9db7..247e98c88a 100644 --- a/app/javascript/flavours/glitch/utils/html.js +++ b/app/javascript/flavours/glitch/utils/html.js @@ -1,3 +1,4 @@ +// NB: This function can still return unsafe HTML export const unescapeHTML = (html) => { const wrapper = document.createElement('div'); wrapper.innerHTML = html.replace(//g, '\n').replace(/<\/p>

/g, '\n\n').replace(/<[^>]*>/g, ''); diff --git a/app/javascript/flavours/glitch/utils/icons.jsx b/app/javascript/flavours/glitch/utils/icons.jsx index 225345af68..be566032e0 100644 --- a/app/javascript/flavours/glitch/utils/icons.jsx +++ b/app/javascript/flavours/glitch/utils/icons.jsx @@ -1,3 +1,5 @@ +// Copied from emoji-mart for consistency with emoji picker and since +// they don't export the icons in the package export const loupeIcon = ( diff --git a/app/javascript/flavours/glitch/utils/notifications.js b/app/javascript/flavours/glitch/utils/notifications.js index 3cdf7caea0..42623ac7c6 100644 --- a/app/javascript/flavours/glitch/utils/notifications.js +++ b/app/javascript/flavours/glitch/utils/notifications.js @@ -3,7 +3,7 @@ const checkNotificationPromise = () => { try { - // eslint-disable-next-line promise/catch-or-return, promise/valid-params + // eslint-disable-next-line promise/valid-params, promise/catch-or-return Notification.requestPermission().then(); } catch(e) { return false;