fix: fix lint

This commit is contained in:
Nolan Lawson 2019-08-19 19:08:59 -07:00
parent 8caa0c08c3
commit 4232da5e33
53 changed files with 132 additions and 113 deletions

View file

@ -9,7 +9,7 @@ const copyFile = promisify(fs.copyFile)
async function compileThirdPartyCss () { async function compileThirdPartyCss () {
let css = await readFile(path.resolve(__dirname, '../node_modules/emoji-mart/css/emoji-mart.css'), 'utf8') let css = await readFile(path.resolve(__dirname, '../node_modules/emoji-mart/css/emoji-mart.css'), 'utf8')
css = `/* compiled from emoji-mart.css */` + new CleanCSS().minify(css).styles css = '/* compiled from emoji-mart.css */' + new CleanCSS().minify(css).styles
await writeFile(path.resolve(__dirname, '../static/emoji-mart.css'), css, 'utf8') await writeFile(path.resolve(__dirname, '../static/emoji-mart.css'), css, 'utf8')
} }

View file

@ -57,9 +57,9 @@ const JSON_TEMPLATE = {
const HTML_HEADERS = { const HTML_HEADERS = {
'cache-control': 'public,max-age=3600', 'cache-control': 'public,max-age=3600',
'content-security-policy': `script-src 'self' ` + 'content-security-policy': 'script-src \'self\' ' +
`${[inlineScriptChecksum].concat(sapperInlineScriptChecksums).map(_ => `'sha256-${_}'`).join(' ')}; ` + `${[inlineScriptChecksum].concat(sapperInlineScriptChecksums).map(_ => `'sha256-${_}'`).join(' ')}; ` +
`worker-src 'self'; style-src 'self' 'unsafe-inline'; frame-src 'none'; object-src 'none'; manifest-src 'self'`, 'worker-src \'self\'; style-src \'self\' \'unsafe-inline\'; frame-src \'none\'; object-src \'none\'; manifest-src \'self\'',
'referrer-policy': 'no-referrer', 'referrer-policy': 'no-referrer',
'strict-transport-security': 'max-age=15552000; includeSubDomains', 'strict-transport-security': 'max-age=15552000; includeSubDomains',
'x-content-type-options': 'nosniff', 'x-content-type-options': 'nosniff',

View file

@ -44,7 +44,7 @@ async function cloneMastodon () {
} catch (e) { } catch (e) {
console.log('Cloning mastodon...') console.log('Cloning mastodon...')
await exec(`git clone --single-branch --branch ${GIT_BRANCH} ${GIT_URL} "${mastodonDir}"`) await exec(`git clone --single-branch --branch ${GIT_BRANCH} ${GIT_URL} "${mastodonDir}"`)
await exec(`git fetch origin --tags`, { cwd: mastodonDir }) // may already be cloned, e.g. in CI await exec('git fetch origin --tags', { cwd: mastodonDir }) // may already be cloned, e.g. in CI
await exec(`git checkout ${GIT_TAG_OR_COMMIT}`, { cwd: mastodonDir }) await exec(`git checkout ${GIT_TAG_OR_COMMIT}`, { cwd: mastodonDir })
await writeFile(path.join(dir, '../mastodon/.env'), envFile, 'utf8') await writeFile(path.join(dir, '../mastodon/.env'), envFile, 'utf8')
} }

View file

@ -57,7 +57,7 @@ export async function logInToInstance () {
(err.knownError ? '' : (navigator.onLine (err.knownError ? '' : (navigator.onLine
? `Is this a valid Mastodon instance? Is a browser extension ? `Is this a valid Mastodon instance? Is a browser extension
blocking the request? Are you in private browsing mode?` blocking the request? Are you in private browsing mode?`
: `Are you offline?`)) : 'Are you offline?'))
const { instanceNameInSearch } = store.get() const { instanceNameInSearch } = store.get()
store.set({ store.set({
logInToInstanceError: error, logInToInstanceError: error,

View file

@ -9,6 +9,6 @@ export async function shareStatus (status) {
url: status.url url: status.url
}) })
} catch (e) { } catch (e) {
toast.say(`Unable to share: ` + (e.message || '')) toast.say('Unable to share: ' + (e.message || ''))
} }
} }

View file

@ -52,7 +52,7 @@
data: () => ({ data: () => ({
loading: true, loading: true,
accounts: [], accounts: [],
accountActions: void 0 accountActions: undefined
}), }),
store: () => store, store: () => store,
components: { components: {

View file

@ -44,7 +44,7 @@
export default { export default {
data: () => ({ data: () => ({
focus: void 0 focus: undefined
}), }),
store: () => store, store: () => store,
computed: { computed: {

View file

@ -48,9 +48,9 @@
export default { export default {
data: () => ({ data: () => ({
className: void 0, className: undefined,
loaded: false, loaded: false,
error: void 0, error: undefined,
isLink: false, isLink: false,
size: 'medium' size: 'medium'
}), }),

View file

@ -66,7 +66,7 @@
export default { export default {
data: () => ({ data: () => ({
icon: void 0, icon: undefined,
ariaTitle: '' ariaTitle: ''
}), }),
components: { components: {

View file

@ -27,7 +27,7 @@
export default { export default {
data: () => ({ data: () => ({
className: void 0, className: undefined,
normalIconColor: false, normalIconColor: false,
ariaLabel: '', ariaLabel: '',
showIcon: false showIcon: false

View file

@ -1,7 +1,7 @@
<button type="button" <button type="button"
title={label} title={label}
aria-label={label} aria-label={label}
aria-pressed={pressable ? !!pressed : void 0} aria-pressed={pressable ? !!pressed : undefined}
aria-hidden={ariaHidden} aria-hidden={ariaHidden}
class={computedClass} class={computedClass}
{disabled} {disabled}
@ -112,11 +112,11 @@
big: false, big: false,
muted: false, muted: false,
disabled: false, disabled: false,
svgClassName: void 0, svgClassName: undefined,
elementId: void 0, elementId: undefined,
pressable: false, pressable: false,
pressed: false, pressed: false,
className: void 0, className: undefined,
sameColorWhenPressed: false, sameColorWhenPressed: false,
ariaHidden: false, ariaHidden: false,
clickListener: true clickListener: true

View file

@ -21,7 +21,7 @@
<script> <script>
export default { export default {
data: () => ({ data: () => ({
className: void 0 className: undefined
}) })
} }
</script> </script>

View file

@ -46,15 +46,15 @@
data: () => ({ data: () => ({
error: false, error: false,
forceSize: false, forceSize: false,
fallback: void 0, fallback: undefined,
focus: void 0, focus: undefined,
background: '', background: '',
width: void 0, width: undefined,
height: void 0, height: undefined,
ariaHidden: false, ariaHidden: false,
alt: '', alt: '',
title: '', title: '',
blurhash: void 0 blurhash: undefined
}), }),
computed: { computed: {
computedStyle: ({ background }) => { computedStyle: ({ background }) => {

View file

@ -68,7 +68,7 @@
}, },
data: () => ({ data: () => ({
oneTransparentPixel: ONE_TRANSPARENT_PIXEL, oneTransparentPixel: ONE_TRANSPARENT_PIXEL,
focus: void 0 focus: undefined
}), }),
components: { components: {
PlayVideoIcon, PlayVideoIcon,

View file

@ -13,12 +13,12 @@
{ {
name: '', name: '',
label: 'All', label: 'All',
href: `/notifications` href: '/notifications'
}, },
{ {
name: 'mentions', name: 'mentions',
label: 'Mentions', label: 'Mentions',
href: `/notifications/mentions` href: '/notifications/mentions'
} }
] ]
}), }),

View file

@ -27,7 +27,7 @@
export default { export default {
data: () => ({ data: () => ({
className: void 0 className: undefined
}), }),
components: { components: {
SvgIcon SvgIcon

View file

@ -113,11 +113,13 @@
!!($autosuggestShown && composeFocused) !!($autosuggestShown && composeFocused)
), ),
// text that is read to screen readers. based on https://haltersweb.github.io/Accessibility/autocomplete.html // text that is read to screen readers. based on https://haltersweb.github.io/Accessibility/autocomplete.html
assertiveAriaText: ({ shouldBeShown, assertiveAriaText: ({
shouldBeShown,
autosuggestSearchResults, autosuggestSearchResults,
autosuggestSelected, autosuggestSelected,
autosuggestType, autosuggestType,
$omitEmojiInDisplayNames }) => { $omitEmojiInDisplayNames
}) => {
if (!shouldBeShown || !autosuggestSearchResults || !autosuggestSearchResults.length) { if (!shouldBeShown || !autosuggestSearchResults || !autosuggestSearchResults.length) {
return '' return ''
} }

View file

@ -135,12 +135,12 @@
ComposePoll ComposePoll
}, },
data: () => ({ data: () => ({
size: void 0, size: undefined,
isReply: false, isReply: false,
autoFocus: false, autoFocus: false,
hideBottomBorder: false, hideBottomBorder: false,
hidden: false, hidden: false,
dialogId: void 0 dialogId: undefined
}), }),
store: () => store, store: () => store,
computed: { computed: {

View file

@ -151,24 +151,29 @@
// ctrl or cmd (on macs) was pressed; ctrl-enter means post a toot // ctrl or cmd (on macs) was pressed; ctrl-enter means post a toot
const ctrlPressed = e.getModifierState('Control') || e.getModifierState('Meta') const ctrlPressed = e.getModifierState('Control') || e.getModifierState('Meta')
switch (keyCode) { switch (keyCode) {
case 9: // tab case 9: { // tab
this.clickSelectedAutosuggestion(e) this.clickSelectedAutosuggestion(e)
break break
case 13: // enter }
case 13: { // enter
const autosuggestionClicked = this.clickSelectedAutosuggestion(e) const autosuggestionClicked = this.clickSelectedAutosuggestion(e)
if (!autosuggestionClicked && ctrlPressed) { if (!autosuggestionClicked && ctrlPressed) {
this.fire('postAction') this.fire('postAction')
} }
break break
case 38: // up }
case 38: { // up
this.incrementAutosuggestSelected(-1, e) this.incrementAutosuggestSelected(-1, e)
break break
case 40: // down }
case 40: { // down
this.incrementAutosuggestSelected(1, e) this.incrementAutosuggestSelected(1, e)
break break
case 27: // escape }
case 27: { // escape
this.clearAutosuggestions(e) this.clearAutosuggestions(e)
break break
}
default: default:
} }
}, },

View file

@ -21,7 +21,7 @@
onCreateDialog.call(this) onCreateDialog.call(this)
}, },
data: () => ({ data: () => ({
title: void 0, title: undefined,
realm: 'dialog' realm: 'dialog'
}), }),
methods: { methods: {

View file

@ -48,10 +48,10 @@
onCreateDialog.call(this) onCreateDialog.call(this)
}, },
data: () => ({ data: () => ({
component: void 0, component: undefined,
text: void 0, text: undefined,
onPositive: void 0, onPositive: undefined,
onNegative: void 0, onNegative: undefined,
title: '', title: '',
positiveText: 'OK', positiveText: 'OK',
negativeText: 'Cancel' negativeText: 'Cancel'

View file

@ -117,7 +117,7 @@
data: () => ({ data: () => ({
loading: true, loading: true,
loaded: false, loaded: false,
error: void 0 error: undefined
}), }),
computed: { computed: {
// try to estimate size of emoji-mart based on mobile vs desktop // try to estimate size of emoji-mart based on mobile vs desktop

View file

@ -42,8 +42,8 @@
onCreateDialog.call(this) onCreateDialog.call(this)
}, },
data: () => ({ data: () => ({
positiveText: void 0, positiveText: undefined,
negativeText: void 0, negativeText: undefined,
className: '' className: ''
}), }),
methods: { methods: {

View file

@ -188,8 +188,8 @@
shouldAnimate: !process.browser || document.getElementsByClassName('modal-dialog').length < 2, shouldAnimate: !process.browser || document.getElementsByClassName('modal-dialog').length < 2,
fadedIn: false, fadedIn: false,
muted: false, muted: false,
className: void 0, className: undefined,
title: void 0, title: undefined,
shrinkWidthToFit: false, shrinkWidthToFit: false,
clickHeaderToClose: false clickHeaderToClose: false
}), }),

View file

@ -185,8 +185,8 @@
}, },
store: () => store, store: () => store,
data: () => ({ data: () => ({
account: void 0, account: undefined,
status: void 0, status: undefined,
positiveText: 'Report', positiveText: 'Report',
reportMap: {}, reportMap: {},
recentStatuses: [], recentStatuses: [],
@ -219,7 +219,7 @@
const { displayStatuses, account, comment, forward, reportMap } = this.get() const { displayStatuses, account, comment, forward, reportMap } = this.get()
const statusIds = displayStatuses.map(({ id }) => id).filter(id => reportMap[id]) const statusIds = displayStatuses.map(({ id }) => id).filter(id => reportMap[id])
if (!statusIds.length) { if (!statusIds.length) {
toast.say(`No toots to report.`) toast.say('No toots to report.')
} else { } else {
await reportStatuses(account, statusIds, comment, forward) await reportStatuses(account, statusIds, comment, forward)
} }

View file

@ -79,7 +79,7 @@ export default {
mentions: ({ status }) => status.mentions || [], mentions: ({ status }) => status.mentions || [],
mentionsUser: ({ mentions, verifyCredentialsId }) => !!mentions.find(_ => _.id === verifyCredentialsId), mentionsUser: ({ mentions, verifyCredentialsId }) => !!mentions.find(_ => _.id === verifyCredentialsId),
mutingConversation: ({ status }) => !!status.muted, mutingConversation: ({ status }) => !!status.muted,
muteConversationLabel: ({ mutingConversation }) => mutingConversation ? `Unmute conversation` : `Mute conversation`, muteConversationLabel: ({ mutingConversation }) => mutingConversation ? 'Unmute conversation' : 'Mute conversation',
muteConversationIcon: ({ mutingConversation }) => mutingConversation ? '#fa-volume-up' : '#fa-volume-off', muteConversationIcon: ({ mutingConversation }) => mutingConversation ? '#fa-volume-up' : '#fa-volume-off',
isPublicOrUnlisted: ({ visibility }) => visibility === 'public' || visibility === 'unlisted', isPublicOrUnlisted: ({ visibility }) => visibility === 'public' || visibility === 'unlisted',
items: ({ items: ({

View file

@ -23,9 +23,9 @@
export default { export default {
oncreate, oncreate,
data: () => ({ data: () => ({
title: void 0, title: undefined,
positiveText: void 0, positiveText: undefined,
negativeText: void 0 negativeText: undefined
}), }),
methods: { methods: {
show, show,

View file

@ -24,7 +24,7 @@
} }
}, },
data: () => ({ data: () => ({
props: void 0 props: undefined
}), }),
components: { components: {
ListItem ListItem

View file

@ -54,7 +54,7 @@
}, },
store: () => store, store: () => store,
data: () => ({ data: () => ({
overrideFollowing: void 0 overrideFollowing: undefined
}), }),
computed: { computed: {
accountId: ({ account }) => account.id, accountId: ({ account }) => account.id,

View file

@ -77,7 +77,7 @@
export default { export default {
data: () => ({ data: () => ({
actions: void 0 actions: undefined
}), }),
methods: { methods: {
onButtonClick (event, action, accountId) { onButtonClick (event, action, accountId) {

View file

@ -29,7 +29,7 @@
<script> <script>
export default { export default {
data: () => ({ data: () => ({
label: void 0 label: undefined
}) })
} }
</script> </script>

View file

@ -17,8 +17,8 @@
<script> <script>
export default { export default {
data: () => ({ data: () => ({
ariaLabel: void 0, ariaLabel: undefined,
className: void 0 className: undefined
}) })
} }
</script> </script>

View file

@ -37,8 +37,8 @@
<script> <script>
export default { export default {
data: () => ({ data: () => ({
icon: void 0, icon: undefined,
ariaLabel: void 0 ariaLabel: undefined
}) })
} }
</script> </script>

View file

@ -2,11 +2,13 @@
import { import {
isVisible, isVisible,
firstVisibleElementIndex, firstVisibleElementIndex,
scrollIntoViewIfNeeded } from '../../_utils/scrollIntoView' scrollIntoViewIfNeeded
} from '../../_utils/scrollIntoView'
import { import {
addShortcutFallback, addShortcutFallback,
removeShortcutFallback, removeShortcutFallback,
onKeyDownInShortcutScope } from '../../_utils/shortcuts' onKeyDownInShortcutScope
} from '../../_utils/shortcuts'
import { smoothScroll } from '../../_utils/smoothScroll' import { smoothScroll } from '../../_utils/smoothScroll'
import { getScrollContainer } from '../../_utils/scrollContainer' import { getScrollContainer } from '../../_utils/scrollContainer'

View file

@ -1,7 +1,8 @@
<script> <script>
import { import {
addToShortcutScope, addToShortcutScope,
removeFromShortcutScope } from '../../_utils/shortcuts' removeFromShortcutScope
} from '../../_utils/shortcuts'
export default { export default {
data: () => ({ scope: 'global', key: null }), data: () => ({ scope: 'global', key: null }),
oncreate () { oncreate () {
@ -18,7 +19,8 @@
event.preventDefault() event.preventDefault()
this.fire('pressed', { this.fire('pressed', {
key: event.key, key: event.key,
timeStamp: event.timeStamp }) timeStamp: event.timeStamp
})
} }
} }
} }

View file

@ -164,7 +164,7 @@ export default {
}, },
data: () => ({ data: () => ({
oneTransparentPixel: ONE_TRANSPARENT_PIXEL, oneTransparentPixel: ONE_TRANSPARENT_PIXEL,
mouseover: void 0 mouseover: undefined
}), }),
store: () => store, store: () => store,
events: { events: {

View file

@ -176,8 +176,8 @@
Shortcut Shortcut
}, },
data: () => ({ data: () => ({
notification: void 0, notification: undefined,
replyVisibility: void 0, replyVisibility: undefined,
contentPreloaded: false, contentPreloaded: false,
enableShortcuts: null enableShortcuts: null
}), }),
@ -284,8 +284,10 @@
absoluteFormattedDate: ({ createdAtDateTS }) => absoluteDateFormatter.format(createdAtDateTS), absoluteFormattedDate: ({ createdAtDateTS }) => absoluteDateFormatter.format(createdAtDateTS),
timeagoFormattedDate: ({ createdAtDateTS, $now }) => formatTimeagoDate(createdAtDateTS, $now), timeagoFormattedDate: ({ createdAtDateTS, $now }) => formatTimeagoDate(createdAtDateTS, $now),
reblog: ({ status }) => status.reblog, reblog: ({ status }) => status.reblog,
ariaLabel: ({ originalAccount, account, plainTextContent, timeagoFormattedDate, spoilerText, ariaLabel: ({
showContent, reblog, notification, visibility, $omitEmojiInDisplayNames, $disableLongAriaLabels }) => ( originalAccount, account, plainTextContent, timeagoFormattedDate, spoilerText,
showContent, reblog, notification, visibility, $omitEmojiInDisplayNames, $disableLongAriaLabels
}) => (
getAccessibleLabelForStatus(originalAccount, account, plainTextContent, getAccessibleLabelForStatus(originalAccount, account, plainTextContent,
timeagoFormattedDate, spoilerText, showContent, timeagoFormattedDate, spoilerText, showContent,
reblog, notification, visibility, $omitEmojiInDisplayNames, $disableLongAriaLabels) reblog, notification, visibility, $omitEmojiInDisplayNames, $disableLongAriaLabels)
@ -318,11 +320,13 @@
// This params list deliberately does *not* include `spoilersShown` or `replyShown`, because these // This params list deliberately does *not* include `spoilersShown` or `replyShown`, because these
// change frequently and would therefore cause costly recomputes if included here. // change frequently and would therefore cause costly recomputes if included here.
// The main goal here is to avoid typing by passing as many params as possible to child components. // The main goal here is to avoid typing by passing as many params as possible to child components.
params: ({ notification, notificationId, status, statusId, timelineType, params: ({
notification, notificationId, status, statusId, timelineType,
account, accountId, uuid, isStatusInNotification, isStatusInOwnThread, account, accountId, uuid, isStatusInNotification, isStatusInOwnThread,
originalAccount, originalAccountId, visibility, originalAccount, originalAccountId, visibility,
replyVisibility, spoilerText, originalStatus, originalStatusId, inReplyToId, replyVisibility, spoilerText, originalStatus, originalStatusId, inReplyToId,
enableShortcuts, shortcutScope, originalStatusEmojis }) => ({ enableShortcuts, shortcutScope, originalStatusEmojis
}) => ({
notification, notification,
notificationId, notificationId,
status, status,

View file

@ -150,8 +150,8 @@
}, },
store: () => store, store: () => store,
data: () => ({ data: () => ({
overrideNumReblogs: void 0, overrideNumReblogs: undefined,
overrideNumFavs: void 0 overrideNumFavs: undefined
}), }),
computed: { computed: {
originalStatusId: ({ originalStatus }) => originalStatus.id, originalStatusId: ({ originalStatus }) => originalStatus.id,

View file

@ -107,11 +107,11 @@
case 'tag': case 'tag':
return `Statuses: #${timelineValue} hashtag` return `Statuses: #${timelineValue} hashtag`
case 'status': case 'status':
return `Statuses: thread` return 'Statuses: thread'
case 'account': case 'account':
return `Statuses: account timeline` return 'Statuses: account timeline'
case 'list': case 'list':
return `Statuses: list` return 'Statuses: list'
case 'notifications': case 'notifications':
return `Notifications on ${$currentInstance}` return `Notifications on ${$currentInstance}`
} }

View file

@ -21,7 +21,7 @@
} }
}, },
data: () => ({ data: () => ({
props: void 0 props: undefined
}), }),
components: { components: {
VirtualListItem VirtualListItem

View file

@ -22,7 +22,7 @@
export default { export default {
computed: { computed: {
list: ({ params, $lists }) => $lists && $lists.find(_ => _.id === params['listId']), list: ({ params, $lists }) => $lists && $lists.find(_ => _.id === params.listId),
listTitle: ({ list }) => list ? list.title : '' listTitle: ({ list }) => list ? list.title : ''
}, },
store: () => store, store: () => store,

View file

@ -59,7 +59,7 @@ export function timelineComputations (store) {
) )
store.compute('currentTimelineValue', ['currentTimeline'], currentTimeline => { store.compute('currentTimelineValue', ['currentTimeline'], currentTimeline => {
if (!currentTimeline) { if (!currentTimeline) {
return void 0 return undefined
} }
const split = currentTimeline.split('/') const split = currentTimeline.split('/')
const len = split.length const len = split.length
@ -152,7 +152,7 @@ export function timelineComputations (store) {
) )
store.compute('timelineNotificationItemSummaries', store.compute('timelineNotificationItemSummaries',
[`timelineData_timelineItemSummariesToAdd`, 'timelineFilterFunction', 'currentInstance'], ['timelineData_timelineItemSummariesToAdd', 'timelineFilterFunction', 'currentInstance'],
(root, timelineFilterFunction, currentInstance) => ( (root, timelineFilterFunction, currentInstance) => (
get(root, [currentInstance, 'notifications']) get(root, [currentInstance, 'notifications'])
) )

View file

@ -16,5 +16,5 @@ export function createAutosuggestAccessibleLabel (
label = `${displayName} @${selected.acct}` label = `${displayName} @${selected.acct}`
} }
return `${label} (${selectedIndex + 1} of ${searchResults.length}). ` + return `${label} (${selectedIndex + 1} of ${searchResults.length}). ` +
`Press up and down arrows to review and enter to select.` 'Press up and down arrows to review and enter to select.'
} }

View file

@ -1,6 +1,7 @@
import { import {
getScrollContainer, getScrollContainer,
getOffsetHeight } from './scrollContainer' getOffsetHeight
} from './scrollContainer'
import { smoothScroll } from './smoothScroll' import { smoothScroll } from './smoothScroll'
let mainNavElement let mainNavElement

View file

@ -1,8 +1,8 @@
export function timelineItemToSummary (item) { export function timelineItemToSummary (item) {
return { return {
id: item.id, id: item.id,
replyId: (item.in_reply_to_id) || void 0, replyId: (item.in_reply_to_id) || undefined,
reblogId: (item.reblog && item.reblog.id) || void 0, reblogId: (item.reblog && item.reblog.id) || undefined,
type: item.type || void 0 type: item.type || undefined
} }
} }

View file

@ -5,10 +5,10 @@
import crypto from 'crypto' import crypto from 'crypto'
const baseScripts = [ const baseScripts = [
`__SAPPER__={baseUrl:"",preloaded:[{},{}]};`, '__SAPPER__={baseUrl:"",preloaded:[{},{}]};',
`__SAPPER__={baseUrl:"",preloaded:[{}]};`, '__SAPPER__={baseUrl:"",preloaded:[{}]};',
`__SAPPER__={baseUrl:"",preloaded:[{},null,null,{}]};`, '__SAPPER__={baseUrl:"",preloaded:[{},null,null,{}]};',
`__SAPPER__={baseUrl:"",preloaded:[{},null,{}]};` '__SAPPER__={baseUrl:"",preloaded:[{},null,{}]};'
] ]
const scriptsWithSW = baseScripts.map(script => ( const scriptsWithSW = baseScripts.map(script => (

View file

@ -156,7 +156,7 @@ async function showRichNotification (data, notification) {
} }
case 'reblog': case 'reblog':
case 'favourite': case 'favourite':
case 'poll': case 'poll': {
await self.registration.showNotification(data.title, { await self.registration.showNotification(data.title, {
badge, badge,
icon, icon,
@ -167,7 +167,8 @@ async function showRichNotification (data, notification) {
} }
}) })
break break
case 'mention': }
case 'mention': {
const isPublic = ['public', 'unlisted'].includes(notification.status.visibility) const isPublic = ['public', 'unlisted'].includes(notification.status.visibility)
const actions = [ const actions = [
isPublic && { isPublic && {
@ -198,6 +199,7 @@ async function showRichNotification (data, notification) {
break break
} }
} }
}
const cloneNotification = notification => { const cloneNotification = notification => {
const clone = {} const clone = {}

View file

@ -50,8 +50,8 @@ test('content warnings can have emoji', async t => {
}) })
test('no XSS in content warnings or text', async t => { test('no XSS in content warnings or text', async t => {
const pwned1 = `<script>alert("pwned!")</script>` const pwned1 = '<script>alert("pwned!")</script>'
const pwned2 = `<script>alert("pwned from CW!")</script>` const pwned2 = '<script>alert("pwned from CW!")</script>'
await loginAsFoobar(t) await loginAsFoobar(t)
await t await t
.typeText(composeInput, pwned1) .typeText(composeInput, pwned1)

View file

@ -101,7 +101,7 @@ test('Check status aria labels for de-emojified text', async t => {
.click(homeNavButton) .click(homeNavButton)
.click(displayNameInComposeBox) .click(displayNameInComposeBox)
.expect(getNthStatus(1).getAttribute('aria-label')).match( .expect(getNthStatus(1).getAttribute('aria-label')).match(
new RegExp(`foo, hey ho lotsa emojos, (.* ago|just now), @foobar, Public`, 'i') new RegExp('foo, hey ho lotsa emojos, (.* ago|just now), @foobar, Public', 'i')
) )
.click(settingsNavButton) .click(settingsNavButton)
.click(generalSettingsButton) .click(generalSettingsButton)

View file

@ -26,7 +26,7 @@ const INSTANCE_INFO = {
const createStatus = i => ({ const createStatus = i => ({
id: i.toString(), id: i.toString(),
created_at: new Date().toISOString(), created_at: new Date().toISOString(),
content: `Status #4{id}`, content: 'Status #4{id}',
account: { account: {
id: '1' id: '1'
} }

View file

@ -63,17 +63,17 @@ describe('test-emoji.js', function () {
it('does not replace non-emoji characters', function () { it('does not replace non-emoji characters', function () {
const replacer = _ => `<div>${_}</div>` const replacer = _ => `<div>${_}</div>`
assert.strictEqual( assert.strictEqual(
replaceEmoji(`it's over #9000`, replacer), replaceEmoji('it\'s over #9000', replacer),
`it's over #9000` 'it\'s over #9000'
) )
assert.strictEqual( assert.strictEqual(
replaceEmoji(`woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£™℠®`, replacer), replaceEmoji('woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®', replacer),
`woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£™℠®` 'woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®'
) )
assert.strictEqual( assert.strictEqual(
replaceEmoji(`woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£™℠®`, replacer), replaceEmoji('woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®', replacer),
`woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£™℠®` 'woot !@#$%^&*()~' + '`' + '{[}]:;"\'<,>.?/£™℠®'
) )
// hidden VARIATION SELECTOR character is in here // hidden VARIATION SELECTOR character is in here
@ -118,19 +118,19 @@ describe('test-emoji.js', function () {
const replacer = _ => '' const replacer = _ => ''
assert.strictEqual( assert.strictEqual(
replaceEmoji(`woot ${mindBlown}`, replacer), replaceEmoji(`woot ${mindBlown}`, replacer),
`woot ` 'woot '
) )
assert.strictEqual( assert.strictEqual(
replaceEmoji(`woot ${mindBlown} woot`, replacer), replaceEmoji(`woot ${mindBlown} woot`, replacer),
`woot woot` 'woot woot'
) )
assert.strictEqual( assert.strictEqual(
replaceEmoji(`woot ${mindBlown}${elephant}`, replacer), replaceEmoji(`woot ${mindBlown}${elephant}`, replacer),
`woot ` 'woot '
) )
assert.strictEqual( assert.strictEqual(
replaceEmoji(`woot ${mindBlown}${elephant} woot`, replacer), replaceEmoji(`woot ${mindBlown}${elephant} woot`, replacer),
`woot woot` 'woot woot'
) )
}) })

View file

@ -7,7 +7,8 @@ import {
onKeyDownInShortcutScope, onKeyDownInShortcutScope,
popShortcutScope, popShortcutScope,
pushShortcutScope, pushShortcutScope,
removeFromShortcutScope } from '../../src/routes/_utils/shortcuts' removeFromShortcutScope
} from '../../src/routes/_utils/shortcuts'
import assert from 'assert' import assert from 'assert'
function KeyDownEvent (key) { function KeyDownEvent (key) {

View file

@ -50,7 +50,7 @@ export const neverMarkMediaSensitiveInput = $('#choice-never-mark-media-sensitiv
export const removeEmojiFromDisplayNamesInput = $('#choice-omit-emoji-in-display-names') export const removeEmojiFromDisplayNamesInput = $('#choice-omit-emoji-in-display-names')
export const disableInfiniteScroll = $('#choice-disable-infinite-scroll') export const disableInfiniteScroll = $('#choice-disable-infinite-scroll')
export const disableUnreadNotifications = $('#choice-disable-unread-notification-counts') export const disableUnreadNotifications = $('#choice-disable-unread-notification-counts')
export const dialogOptionsOption = $(`.modal-dialog button`) export const dialogOptionsOption = $('.modal-dialog button')
export const emojiSearchInput = $('.emoji-mart-search input') export const emojiSearchInput = $('.emoji-mart-search input')
export const confirmationDialogOKButton = $('.confirmation-dialog-form-flex button:nth-child(1)') export const confirmationDialogOKButton = $('.confirmation-dialog-form-flex button:nth-child(1)')
export const confirmationDialogCancelButton = $('.confirmation-dialog-form-flex button:nth-child(2)') export const confirmationDialogCancelButton = $('.confirmation-dialog-form-flex button:nth-child(2)')
@ -353,7 +353,7 @@ export function getNthStatusAndImage (nStatus, nImage) {
} }
export function getFirstVisibleStatus () { export function getFirstVisibleStatus () {
return $(`.list-item > article[aria-posinset]`).nth(0) return $('.list-item > article[aria-posinset]').nth(0)
} }
export function getNthReplyButton (n) { export function getNthReplyButton (n) {