logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: fddb531ed20b31c44e6911418e7bbb884836c40a
parent 0cbfcb99a9ffaf771adbe37320bba157019f65ff
Author: Henry Jameson <me@hjkos.com>
Date:   Sun, 31 Jul 2022 12:35:48 +0300

--fix

Diffstat:

Msrc/App.vue20++++++++++++++++----
Msrc/boot/after_store.js4++--
Msrc/boot/routes.js9++++++---
Msrc/components/about/about.vue2+-
Msrc/components/account_actions/account_actions.vue4++--
Msrc/components/avatar_list/avatar_list.vue2+-
Msrc/components/basic_user_card/basic_user_card.vue11+++++++----
Msrc/components/chat/chat.js2+-
Msrc/components/chat_list/chat_list.vue2+-
Msrc/components/chat_message/chat_message.vue10+++++-----
Msrc/components/chat_title/chat_title.vue4++--
Msrc/components/checkbox/checkbox.vue4++--
Msrc/components/color_input/color_input.vue2+-
Msrc/components/conversation/conversation.js2+-
Msrc/components/conversation/conversation.vue2+-
Msrc/components/desktop_nav/desktop_nav.js24++++++++++++++----------
Msrc/components/domain_mute_card/domain_mute_card.vue4++--
Msrc/components/emoji_input/emoji_input.js2+-
Msrc/components/emoji_picker/emoji_picker.js2+-
Msrc/components/emoji_reactions/emoji_reactions.vue2+-
Msrc/components/extra_buttons/extra_buttons.js2+-
Msrc/components/extra_buttons/extra_buttons.vue6+++---
Msrc/components/favorite_button/favorite_button.vue2+-
Msrc/components/features_panel/features_panel.vue2+-
Msrc/components/flash/flash.js2+-
Msrc/components/font_control/font_control.vue2+-
Msrc/components/hashtag_link/hashtag_link.vue4++--
Msrc/components/image_cropper/image_cropper.js2+-
Msrc/components/instance_specific_panel/instance_specific_panel.vue2+-
Msrc/components/interactions/interactions.js2+-
Msrc/components/interface_language_switcher/interface_language_switcher.vue1+
Msrc/components/login_form/login_form.js2+-
Msrc/components/login_form/login_form.vue2+-
Msrc/components/media_upload/media_upload.js5+++--
Msrc/components/media_upload/media_upload.vue2+-
Msrc/components/mention_link/mention_link.vue17++++++++++-------
Msrc/components/mentions_line/mentions_line.vue14+++++++-------
Msrc/components/mfa_form/recovery_form.vue2+-
Msrc/components/mobile_nav/mobile_nav.vue5++---
Msrc/components/modal/modal.vue8++++----
Msrc/components/moderation_tools/moderation_tools.vue8++++----
Msrc/components/mrf_transparency_panel/mrf_transparency_panel.js6+++---
Msrc/components/nav_panel/nav_panel.vue2+-
Msrc/components/notification/notification.js2+-
Msrc/components/notification/notification.vue4++--
Msrc/components/notifications/notification_filters.vue4++--
Msrc/components/notifications/notifications.vue5++++-
Msrc/components/popover/popover.js34+++++++++++++++++++---------------
Msrc/components/post_status_form/post_status_form.js16++++++++--------
Msrc/components/react_button/react_button.js2+-
Msrc/components/react_button/react_button.vue8++++----
Msrc/components/remote_follow/remote_follow.js2+-
Msrc/components/retweet_button/retweet_button.vue2+-
Msrc/components/search_bar/search_bar.js2+-
Msrc/components/selectable_list/selectable_list.vue4++--
Msrc/components/settings_modal/helpers/modified_indicator.vue4++--
Msrc/components/settings_modal/helpers/server_side_indicator.vue4++--
Msrc/components/settings_modal/settings_modal.vue4++--
Msrc/components/settings_modal/tabs/general_tab.vue10++++++++--
Msrc/components/settings_modal/tabs/mutes_and_blocks_tab.vue34+++++++++++++++++-----------------
Msrc/components/settings_modal/tabs/profile_tab.js10++++++----
Msrc/components/settings_modal/tabs/profile_tab.vue2+-
Msrc/components/settings_modal/tabs/security_tab/mfa.js6+++---
Msrc/components/settings_modal/tabs/security_tab/mfa_totp.js2+-
Msrc/components/settings_modal/tabs/security_tab/security_tab.js2+-
Msrc/components/settings_modal/tabs/theme_tab/preview.vue5++++-
Msrc/components/settings_modal/tabs/theme_tab/theme_tab.js8++++----
Msrc/components/shadow_control/shadow_control.js8+++++---
Msrc/components/shadow_control/shadow_control.vue2+-
Msrc/components/shout_panel/shout_panel.js2+-
Msrc/components/side_drawer/side_drawer.js2+-
Msrc/components/side_drawer/side_drawer.vue2+-
Msrc/components/staff_panel/staff_panel.js4++--
Msrc/components/staff_panel/staff_panel.vue2+-
Msrc/components/status/status.js6+++---
Msrc/components/status/status.vue11+++++++----
Msrc/components/status_body/status_body.vue2+-
Msrc/components/status_content/status_content.vue2+-
Msrc/components/status_popover/status_popover.vue8++++----
Msrc/components/sticker_picker/sticker_picker.js4++--
Msrc/components/terms_of_service_panel/terms_of_service_panel.vue2+-
Msrc/components/timeline/timeline.vue5++++-
Msrc/components/timeline/timeline_quick_settings.vue4++--
Msrc/components/timeline_menu/timeline_menu.js6+++---
Msrc/components/timeline_menu/timeline_menu.vue6+++---
Msrc/components/timeline_menu/timeline_menu_content.vue2+-
Msrc/components/user_card/user_card.js2+-
Msrc/components/user_card/user_card.vue2+-
Msrc/components/user_list_popover/user_list_popover.vue6+++---
Msrc/components/user_popover/user_popover.vue42+++++++++++++++++++++---------------------
Msrc/components/user_profile/user_profile.vue15+++++++++------
Msrc/components/user_reporting_modal/user_reporting_modal.vue2+-
Msrc/components/who_to_follow/who_to_follow.js2+-
Msrc/components/who_to_follow_panel/who_to_follow_panel.js10+++++-----
Msrc/components/who_to_follow_panel/who_to_follow_panel.vue2+-
Msrc/i18n/messages.js2+-
Msrc/lib/notification-i18n-loader.js4++--
Msrc/lib/persisted_state.js12+++++++-----
Msrc/modules/api.js4++--
Msrc/modules/config.js2+-
Msrc/modules/errors.js4++--
Msrc/modules/serverSideConfig.js28++++++++++++++--------------
Msrc/modules/statuses.js20++++++++++----------
Msrc/modules/users.js24++++++++++++------------
Msrc/services/api/api.service.js72++++++++++++++++++++++++++++++++++++------------------------------------
Msrc/services/chat_service/chat_service.js12++++++------
Msrc/services/chat_utils/chat_utils.js2+-
Msrc/services/color_convert/color_convert.js12+++++++-----
Msrc/services/completion/completion.js2+-
Msrc/services/date_utils/date_utils.js2+-
Msrc/services/entity_normalizer/entity_normalizer.service.js4++--
Msrc/services/file_size_format/file_size_format.js8++++----
Msrc/services/html_converter/html_line_converter.service.js4++--
Msrc/services/html_converter/utility.service.js2+-
Msrc/services/locale/locale.service.js14+++++++-------
Msrc/services/new_api/password_reset.js2+-
Msrc/services/notifications_fetcher/notifications_fetcher.service.js12++++++------
Msrc/services/push/push.js4++--
Msrc/services/theme_data/theme_data.service.js2+-
Msrc/services/timeline_fetcher/timeline_fetcher.service.js16++++++++--------
Msrc/services/user_highlighter/user_highlighter.js2+-
Msrc/sw.js4++--
Mtest/e2e/custom-assertions/elementCount.js2+-
Mtest/e2e/nightwatch.conf.js54+++++++++++++++++++++++++++---------------------------
Mtest/e2e/runner.js8++++----
Mtest/unit/karma.conf.js14+++++++-------
Mtest/unit/specs/components/emoji_input.spec.js2+-
Mtest/unit/specs/components/rich_content.spec.js2+-
Mtest/unit/specs/components/user_profile.spec.js6+++---
Mtest/unit/specs/modules/statuses.spec.js4++--
Mtest/unit/specs/services/chat_service/chat_service.spec.js24++++++++++++------------
Mtest/unit/specs/services/entity_normalizer/entity_normalizer.spec.js8++++----
Mtest/unit/specs/services/file_size_format/file_size_format.spec.js4++--
133 files changed, 508 insertions(+), 449 deletions(-)

diff --git a/src/App.vue b/src/App.vue @@ -15,8 +15,12 @@ class="app-layout container" :class="classes" > - <div class="underlay"/> - <div id="sidebar" class="column -scrollable" :class="{ '-show-scrollbar': showScrollbars }"> + <div class="underlay" /> + <div + id="sidebar" + class="column -scrollable" + :class="{ '-show-scrollbar': showScrollbars }" + > <user-panel /> <template v-if="layoutType !== 'mobile'"> <nav-panel /> @@ -26,7 +30,11 @@ <div id="notifs-sidebar" /> </template> </div> - <div id="main-scroller" class="column main" :class="{ '-full-height': isChats }"> + <div + id="main-scroller" + class="column main" + :class="{ '-full-height': isChats }" + > <div v-if="!currentUser" class="login-hint panel panel-default" @@ -40,7 +48,11 @@ </div> <router-view /> </div> - <div id="notifs-column" class="column -scrollable" :class="{ '-show-scrollbar': showScrollbars }"/> + <div + id="notifs-column" + class="column -scrollable" + :class="{ '-show-scrollbar': showScrollbars }" + /> </div> <MediaModal /> <shout-panel diff --git a/src/boot/after_store.js b/src/boot/after_store.js @@ -156,7 +156,7 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => { copyInstanceOption('hideSitename') copyInstanceOption('sidebarRight') - return store.dispatch('setTheme', config['theme']) + return store.dispatch('setTheme', config.theme) } const getTOS = async ({ store }) => { @@ -197,7 +197,7 @@ const getStickers = async ({ store }) => { const stickers = (await Promise.all( Object.entries(values).map(async ([name, path]) => { const resPack = await window.fetch(path + 'pack.json') - var meta = {} + let meta = {} if (resPack.ok) { meta = await resPack.json() } diff --git a/src/boot/routes.js b/src/boot/routes.js @@ -31,7 +31,8 @@ export default (store) => { } let routes = [ - { name: 'root', + { + name: 'root', path: '/', redirect: _to => { return (store.state.users.currentUser @@ -45,12 +46,14 @@ export default (store) => { { name: 'tag-timeline', path: '/tag/:tag', component: TagTimeline }, { name: 'bookmarks', path: '/bookmarks', component: BookmarkTimeline }, { name: 'conversation', path: '/notice/:id', component: ConversationPage, meta: { dontScroll: true } }, - { name: 'remote-user-profile-acct', + { + name: 'remote-user-profile-acct', path: '/remote-users/:_(@)?:username([^/@]+)@:hostname([^/@]+)', component: RemoteUserResolver, beforeEnter: validateAuthenticatedRoute }, - { name: 'remote-user-profile', + { + name: 'remote-user-profile', path: '/remote-users/:hostname/:username', component: RemoteUserResolver, beforeEnter: validateAuthenticatedRoute diff --git a/src/components/about/about.vue b/src/components/about/about.vue @@ -8,7 +8,7 @@ </div> </template> -<script src="./about.js" ></script> +<script src="./about.js"></script> <style lang="scss"> </style> diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue @@ -6,7 +6,7 @@ :bound-to="{ x: 'container' }" remove-padding > - <template v-slot:content> + <template #content> <div class="dropdown-menu"> <template v-if="relationship.following"> <button @@ -57,7 +57,7 @@ </button> </div> </template> - <template v-slot:trigger> + <template #trigger> <button class="button-unstyled ellipsis-button"> <FAIcon class="icon" diff --git a/src/components/avatar_list/avatar_list.vue b/src/components/avatar_list/avatar_list.vue @@ -14,7 +14,7 @@ </div> </template> -<script src="./avatar_list.js" ></script> +<script src="./avatar_list.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/basic_user_card/basic_user_card.vue b/src/components/basic_user_card/basic_user_card.vue @@ -1,10 +1,13 @@ <template> <div class="basic-user-card"> - <router-link @click.prevent :to="userProfileLink(user)"> + <router-link + :to="userProfileLink(user)" + @click.prevent + > <UserPopover - :userId="user.id" - :overlayCenters="true" - overlayCentersSelector=".avatar" + :user-id="user.id" + :overlay-centers="true" + overlay-centers-selector=".avatar" > <UserAvatar class="user-avatar avatar" diff --git a/src/components/chat/chat.js b/src/components/chat/chat.js @@ -107,7 +107,7 @@ const Chat = { } }) }, - '$route': function () { + $route: function () { this.startFetching() }, mastoUserSocketStatus (newValue) { diff --git a/src/components/chat_list/chat_list.vue b/src/components/chat_list/chat_list.vue @@ -23,7 +23,7 @@ class="timeline" > <List :items="sortedChatList"> - <template v-slot:item="{item}"> + <template #item="{item}"> <ChatListItem :key="item.id" :compact="false" diff --git a/src/components/chat_message/chat_message.vue b/src/components/chat_message/chat_message.vue @@ -16,7 +16,7 @@ > <UserPopover v-if="chatViewItem.isHead" - :userId="author.id" + :user-id="author.id" > <UserAvatar :compact="true" @@ -50,7 +50,7 @@ @show="menuOpened = true" @close="menuOpened = false" > - <template v-slot:content> + <template #content> <div class="dropdown-menu"> <button class="button-default dropdown-item dropdown-item-icon" @@ -60,7 +60,7 @@ </button> </div> </template> - <template v-slot:trigger> + <template #trigger> <button class="button-default menu-icon" :title="$t('chats.more')" @@ -75,7 +75,7 @@ :status="messageForStatusContent" :full-content="true" > - <template v-slot:footer> + <template #footer> <span class="created-at" > @@ -96,7 +96,7 @@ </div> </template> -<script src="./chat_message.js" ></script> +<script src="./chat_message.js"></script> <style lang="scss"> @import './chat_message.scss'; diff --git a/src/components/chat_title/chat_title.vue b/src/components/chat_title/chat_title.vue @@ -4,9 +4,9 @@ :title="title" > <UserPopover - class="avatar-container" v-if="withAvatar && user" - :userId="user.id" + class="avatar-container" + :user-id="user.id" > <UserAvatar class="titlebar-avatar" diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue @@ -22,12 +22,12 @@ <script> export default { - emits: ['update:modelValue'], props: [ 'modelValue', 'indeterminate', 'disabled' - ] + ], + emits: ['update:modelValue'] } </script> diff --git a/src/components/color_input/color_input.vue b/src/components/color_input/color_input.vue @@ -46,7 +46,6 @@ </div> </div> </template> -<style lang="scss" src="./color_input.scss"></style> <script> import Checkbox from '../checkbox/checkbox.vue' import { hex2rgb } from '../../services/color_convert/color_convert.js' @@ -108,6 +107,7 @@ export default { } } </script> +<style lang="scss" src="./color_input.scss"></style> <style lang="scss"> .color-control { diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js @@ -271,7 +271,7 @@ const conversation = { result[irid] = result[irid] || [] result[irid].push({ name: `#${i}`, - id: id + id }) } i++ diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue @@ -31,8 +31,8 @@ keypath="status.show_all_conversation_with_icon" tag="button" class="button-unstyled -link" - @click.prevent="diveToTopLevel" scope="global" + @click.prevent="diveToTopLevel" > <template #icon> <FAIcon diff --git a/src/components/desktop_nav/desktop_nav.js b/src/components/desktop_nav/desktop_nav.js @@ -46,23 +46,27 @@ export default { enableMask () { return this.supportsMask && this.$store.state.instance.logoMask }, logoStyle () { return { - 'visibility': this.enableMask ? 'hidden' : 'visible' + visibility: this.enableMask ? 'hidden' : 'visible' } }, logoMaskStyle () { - return this.enableMask ? { - 'mask-image': `url(${this.$store.state.instance.logo})` - } : { - 'background-color': this.enableMask ? '' : 'transparent' - } + return this.enableMask + ? { + 'mask-image': `url(${this.$store.state.instance.logo})` + } + : { + 'background-color': this.enableMask ? '' : 'transparent' + } }, logoBgStyle () { return Object.assign({ - 'margin': `${this.$store.state.instance.logoMargin} 0`, + margin: `${this.$store.state.instance.logoMargin} 0`, opacity: this.searchBarHidden ? 1 : 0 - }, this.enableMask ? {} : { - 'background-color': this.enableMask ? '' : 'transparent' - }) + }, this.enableMask + ? {} + : { + 'background-color': this.enableMask ? '' : 'transparent' + }) }, logo () { return this.$store.state.instance.logo }, sitename () { return this.$store.state.instance.name }, diff --git a/src/components/domain_mute_card/domain_mute_card.vue b/src/components/domain_mute_card/domain_mute_card.vue @@ -9,7 +9,7 @@ class="btn button-default" > {{ $t('domain_mute_card.unmute') }} - <template v-slot:progress> + <template #progress> {{ $t('domain_mute_card.unmute_progress') }} </template> </ProgressButton> @@ -19,7 +19,7 @@ class="btn button-default" > {{ $t('domain_mute_card.mute') }} - <template v-slot:progress> + <template #progress> {{ $t('domain_mute_card.mute_progress') }} </template> </ProgressButton> diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js @@ -321,7 +321,7 @@ const EmojiInput = { } }, scrollIntoView () { - const rootRef = this.$refs['picker'].$el + const rootRef = this.$refs.picker.$el /* Scroller is either `window` (replies in TL), sidebar (main post form, * replies in notifs) or mobile post form. Note that getting and setting * scroll is different for `Window` and `Element`s diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js @@ -25,7 +25,7 @@ const filterByKeyword = (list, keyword = '') => { if (keyword === '') return list const keywordLowercase = keyword.toLowerCase() - let orderedEmojiList = [] + const orderedEmojiList = [] for (const emoji of list) { const indexOfKeyword = emoji.displayText.toLowerCase().indexOf(keywordLowercase) if (indexOfKeyword > -1) { diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue @@ -26,7 +26,7 @@ </div> </template> -<script src="./emoji_reactions.js" ></script> +<script src="./emoji_reactions.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js @@ -25,7 +25,7 @@ library.add( ) const ExtraButtons = { - props: [ 'status' ], + props: ['status'], components: { Popover }, methods: { deleteStatus () { diff --git a/src/components/extra_buttons/extra_buttons.vue b/src/components/extra_buttons/extra_buttons.vue @@ -7,7 +7,7 @@ :bound-to="{ x: 'container' }" remove-padding > - <template v-slot:content="{close}"> + <template #content="{close}"> <div class="dropdown-menu"> <button v-if="canMute && !status.thread_muted" @@ -120,7 +120,7 @@ </button> </div> </template> - <template v-slot:trigger> + <template #trigger> <span class="button-unstyled popover-trigger"> <FAIcon class="fa-scale-110 fa-old-padding" @@ -131,7 +131,7 @@ </Popover> </template> -<script src="./extra_buttons.js" ></script> +<script src="./extra_buttons.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/favorite_button/favorite_button.vue b/src/components/favorite_button/favorite_button.vue @@ -29,7 +29,7 @@ </div> </template> -<script src="./favorite_button.js" ></script> +<script src="./favorite_button.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/features_panel/features_panel.vue b/src/components/features_panel/features_panel.vue @@ -32,7 +32,7 @@ </div> </template> -<script src="./features_panel.js" ></script> +<script src="./features_panel.js"></script> <style lang="scss"> .features-panel li { diff --git a/src/components/flash/flash.js b/src/components/flash/flash.js @@ -11,7 +11,7 @@ library.add( ) const Flash = { - props: [ 'src' ], + props: ['src'], data () { return { player: false, // can be true, "hidden", false. hidden = element exists diff --git a/src/components/font_control/font_control.vue b/src/components/font_control/font_control.vue @@ -47,7 +47,7 @@ </div> </template> -<script src="./font_control.js" ></script> +<script src="./font_control.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/hashtag_link/hashtag_link.vue b/src/components/hashtag_link/hashtag_link.vue @@ -14,6 +14,6 @@ </span> </template> -<script src="./hashtag_link.js"/> +<script src="./hashtag_link.js" /> -<style lang="scss" src="./hashtag_link.scss"/> +<style lang="scss" src="./hashtag_link.scss" /> diff --git a/src/components/image_cropper/image_cropper.js b/src/components/image_cropper/image_cropper.js @@ -95,7 +95,7 @@ const ImageCropper = { const fileInput = this.$refs.input if (fileInput.files != null && fileInput.files[0] != null) { this.file = fileInput.files[0] - let reader = new window.FileReader() + const reader = new window.FileReader() reader.onload = (e) => { this.dataUrl = e.target.result this.$emit('open') diff --git a/src/components/instance_specific_panel/instance_specific_panel.vue b/src/components/instance_specific_panel/instance_specific_panel.vue @@ -10,4 +10,4 @@ </div> </template> -<script src="./instance_specific_panel.js" ></script> +<script src="./instance_specific_panel.js"></script> diff --git a/src/components/interactions/interactions.js b/src/components/interactions/interactions.js @@ -12,7 +12,7 @@ const Interactions = { data () { return { allowFollowingMove: this.$store.state.users.currentUser.allow_following_move, - filterMode: tabModeDict['mentions'] + filterMode: tabModeDict.mentions } }, methods: { diff --git a/src/components/interface_language_switcher/interface_language_switcher.vue b/src/components/interface_language_switcher/interface_language_switcher.vue @@ -25,6 +25,7 @@ import Select from '../select/select.vue' export default { components: { + // eslint-disable-next-line vue/no-reserved-component-names Select }, props: { diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js @@ -83,7 +83,7 @@ const LoginForm = { }, clearError () { this.error = false }, focusOnPasswordInput () { - let passwordInput = this.$refs.passwordInput + const passwordInput = this.$refs.passwordInput passwordInput.focus() passwordInput.setSelectionRange(0, passwordInput.value.length) } diff --git a/src/components/login_form/login_form.vue b/src/components/login_form/login_form.vue @@ -90,7 +90,7 @@ </div> </template> -<script src="./login_form.js" ></script> +<script src="./login_form.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/media_upload/media_upload.js b/src/components/media_upload/media_upload.js @@ -42,7 +42,8 @@ const mediaUpload = { .then((fileData) => { self.$emit('uploaded', fileData) self.decreaseUploadCount() - }, (error) => { // eslint-disable-line handle-callback-err + }, (error) => { + console.error('Error uploading file', error) self.$emit('upload-failed', 'default') self.decreaseUploadCount() }) @@ -73,7 +74,7 @@ const mediaUpload = { 'disabled' ], watch: { - 'dropFiles': function (fileInfos) { + dropFiles: function (fileInfos) { if (!this.uploading) { this.multiUpload(fileInfos) } diff --git a/src/components/media_upload/media_upload.vue b/src/components/media_upload/media_upload.vue @@ -26,7 +26,7 @@ </label> </template> -<script src="./media_upload.js" ></script> +<script src="./media_upload.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/mention_link/mention_link.vue b/src/components/mention_link/mention_link.vue @@ -12,7 +12,7 @@ /><!-- eslint-enable vue/no-v-html --> <UserPopover v-else - :userId="user.id" + :user-id="user.id" :disabled="!shouldShowTooltip" > <span @@ -54,16 +54,19 @@ :class="{ '-you': shouldBoldenYou }" > {{ ' ' + $t('status.you') }}</span> <!-- eslint-enable vue/no-v-html --> - </a><span class="full" ref="full"> - <!-- eslint-disable vue/no-v-html --> - @<span v-html="userName" /><span v-html="'@' + serverName" /> - <!-- eslint-enable vue/no-v-html --> + </a><span + ref="full" + class="full" + > + <!-- eslint-disable vue/no-v-html --> + @<span v-html="userName" /><span v-html="'@' + serverName" /> + <!-- eslint-enable vue/no-v-html --> </span> </span> </UserPopover> </span> </template> -<script src="./mention_link.js"/> +<script src="./mention_link.js" /> -<style lang="scss" src="./mention_link.scss"/> +<style lang="scss" src="./mention_link.scss" /> diff --git a/src/components/mentions_line/mentions_line.vue b/src/components/mentions_line/mentions_line.vue @@ -14,12 +14,12 @@ v-if="expanded" class="fullExtraMentions" >{{ ' ' }}<MentionLink - v-for="mention in extraMentions" - :key="mention.index" - class="mention-link" - :content="mention.content" - :url="mention.url" - /> + v-for="mention in extraMentions" + :key="mention.index" + class="mention-link" + :content="mention.content" + :url="mention.url" + /> </span><button v-if="!expanded" class="button-unstyled showMoreLess" @@ -36,5 +36,5 @@ </span> </span> </template> -<script src="./mentions_line.js" ></script> +<script src="./mentions_line.js"></script> <style lang="scss" src="./mentions_line.scss" /> diff --git a/src/components/mfa_form/recovery_form.vue b/src/components/mfa_form/recovery_form.vue @@ -69,4 +69,4 @@ </div> </div> </template> -<script src="./recovery_form.js" ></script> +<script src="./recovery_form.js"></script> diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue @@ -67,11 +67,10 @@ </a> </div> <div - class="mobile-notifications" id="mobile-notifications" + class="mobile-notifications" @scroll="onScroll" - > - </div> + /> </div> <SideDrawer ref="sideDrawer" diff --git a/src/components/modal/modal.vue b/src/components/modal/modal.vue @@ -12,6 +12,9 @@ <script> export default { + provide: { + popoversZLayer: 'modals' + }, props: { isOpen: { type: Boolean, @@ -22,14 +25,11 @@ export default { default: false } }, - provide: { - popoversZLayer: 'modals' - }, computed: { classes () { return { 'modal-background': !this.noBackground, - 'open': this.isOpen + open: this.isOpen } } } diff --git a/src/components/moderation_tools/moderation_tools.vue b/src/components/moderation_tools/moderation_tools.vue @@ -8,7 +8,7 @@ @show="setToggled(true)" @close="setToggled(false)" > - <template v-slot:content> + <template #content> <div class="dropdown-menu"> <span v-if="user.is_local"> <button @@ -122,7 +122,7 @@ </span> </div> </template> - <template v-slot:trigger> + <template #trigger> <button class="btn button-default btn-block moderation-tools-button" :class="{ toggled }" @@ -137,11 +137,11 @@ v-if="showDeleteUserDialog" :on-cancel="deleteUserDialog.bind(this, false)" > - <template v-slot:header> + <template #header> {{ $t('user_card.admin_menu.delete_user') }} </template> <p>{{ $t('user_card.admin_menu.delete_user_confirmation') }}</p> - <template v-slot:footer> + <template #footer> <button class="btn button-default" @click="deleteUserDialog(false)" diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js @@ -9,10 +9,10 @@ import { get } from 'lodash' */ const toInstanceReasonObject = (instances, info, key) => { return instances.map(instance => { - if (info[key] && info[key][instance] && info[key][instance]['reason']) { - return { instance: instance, reason: info[key][instance]['reason'] } + if (info[key] && info[key][instance] && info[key][instance].reason) { + return { instance, reason: info[key][instance].reason } } - return { instance: instance, reason: '' } + return { instance, reason: '' } }) } diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue @@ -90,7 +90,7 @@ </div> </template> -<script src="./nav_panel.js" ></script> +<script src="./nav_panel.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js @@ -40,7 +40,7 @@ const Notification = { unmuted: false } }, - props: [ 'notification' ], + props: ['notification'], components: { StatusContent, UserAvatar, diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue @@ -37,8 +37,8 @@ @click.prevent > <UserPopover - :userId="notification.from_profile.id" - :overlayCenters="true" + :user-id="notification.from_profile.id" + :overlay-centers="true" > <UserAvatar class="post-avatar" diff --git a/src/components/notifications/notification_filters.vue b/src/components/notifications/notification_filters.vue @@ -5,7 +5,7 @@ placement="bottom" :bound-to="{ x: 'container' }" > - <template v-slot:content> + <template #content> <div class="dropdown-menu"> <button class="button-default dropdown-item" @@ -72,7 +72,7 @@ </button> </div> </template> - <template v-slot:trigger> + <template #trigger> <button class="filter-trigger-button button-unstyled"> <FAIcon icon="filter" /> </button> diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue @@ -1,5 +1,8 @@ <template> - <teleport :disabled="minimalMode || disableTeleport" :to="teleportTarget"> + <teleport + :disabled="minimalMode || disableTeleport" + :to="teleportTarget" + > <div :class="{ minimal: minimalMode }" class="Notifications" diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js @@ -104,21 +104,25 @@ const Popover = { // What are the screen bounds for the popover? Viewport vs container // when using viewport, using default margin values to dodge the navbar - const xBounds = this.boundTo && this.boundTo.x === 'container' ? { - min: parentScreenBox.left + (margin.left || 0), - max: parentScreenBox.right - (margin.right || 0) - } : { - min: 0 + (margin.left || 10), - max: window.innerWidth - (margin.right || 10) - } - - const yBounds = this.boundTo && this.boundTo.y === 'container' ? { - min: parentScreenBox.top + (margin.top || 0), - max: parentScreenBox.bottom - (margin.bottom || 0) - } : { - min: 0 + (margin.top || 50), - max: window.innerHeight - (margin.bottom || 5) - } + const xBounds = this.boundTo && this.boundTo.x === 'container' + ? { + min: parentScreenBox.left + (margin.left || 0), + max: parentScreenBox.right - (margin.right || 0) + } + : { + min: 0 + (margin.left || 10), + max: window.innerWidth - (margin.right || 10) + } + + const yBounds = this.boundTo && this.boundTo.y === 'container' + ? { + min: parentScreenBox.top + (margin.top || 0), + max: parentScreenBox.bottom - (margin.bottom || 0) + } + : { + min: 0 + (margin.top || 50), + max: window.innerHeight - (margin.bottom || 5) + } let horizOffset = 0 let vertOffset = 0 diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js @@ -41,7 +41,7 @@ const buildMentionsString = ({ user, attentions = [] }, currentUser) => { allAttentions = uniqBy(allAttentions, 'id') allAttentions = reject(allAttentions, { id: currentUser.id }) - let mentions = map(allAttentions, (attention) => { + const mentions = map(allAttentions, (attention) => { return `@${attention.screen_name}` }) @@ -242,7 +242,7 @@ const PostStatusForm = { }) }, watch: { - 'newStatus': { + newStatus: { deep: true, handler () { this.statusChanged() @@ -273,7 +273,7 @@ const PostStatusForm = { this.$refs.textarea.focus() }) } - let el = this.$el.querySelector('textarea') + const el = this.$el.querySelector('textarea') el.style.height = 'auto' el.style.height = undefined this.error = null @@ -392,7 +392,7 @@ const PostStatusForm = { this.$emit('resize', { delayed: true }) }, removeMediaFile (fileInfo) { - let index = this.newStatus.files.indexOf(fileInfo) + const index = this.newStatus.files.indexOf(fileInfo) this.newStatus.files.splice(index, 1) this.$emit('resize') }, @@ -462,7 +462,7 @@ const PostStatusForm = { }, onEmojiInputInput (e) { this.$nextTick(() => { - this.resize(this.$refs['textarea']) + this.resize(this.$refs.textarea) }) }, resize (e) { @@ -477,8 +477,8 @@ const PostStatusForm = { return } - const formRef = this.$refs['form'] - const bottomRef = this.$refs['bottom'] + const formRef = this.$refs.form + const bottomRef = this.$refs.bottom /* Scroller is either `window` (replies in TL), sidebar (main post form, * replies in notifs) or mobile post form. Note that getting and setting * scroll is different for `Window` and `Element`s @@ -564,7 +564,7 @@ const PostStatusForm = { this.$refs['emoji-input'].resize() }, showEmojiPicker () { - this.$refs['textarea'].focus() + this.$refs.textarea.focus() this.$refs['emoji-input'].triggerShowPicker() }, clearError () { diff --git a/src/components/react_button/react_button.js b/src/components/react_button/react_button.js @@ -45,7 +45,7 @@ const ReactButton = { emojis () { if (this.filterWord !== '') { const filterWordLowercase = trim(this.filterWord.toLowerCase()) - let orderedEmojiList = [] + const orderedEmojiList = [] for (const emoji of this.$store.state.instance.emoji) { if (emoji.replacement === this.filterWord) return [emoji] diff --git a/src/components/react_button/react_button.vue b/src/components/react_button/react_button.vue @@ -9,13 +9,13 @@ popover-class="ReactButton popover-default" @show="focusInput" > - <template v-slot:content="{close}"> + <template #content="{close}"> <div class="reaction-picker-filter"> <input v-model="filterWord" - @input="$event.target.composing = false" size="1" :placeholder="$t('emoji.search_emoji')" + @input="$event.target.composing = false" > </div> <div class="reaction-picker"> @@ -41,7 +41,7 @@ <div class="reaction-bottom-fader" /> </div> </template> - <template v-slot:trigger> + <template #trigger> <span class="button-unstyled popover-trigger" :title="$t('tool_tip.add_reaction')" @@ -55,7 +55,7 @@ </Popover> </template> -<script src="./react_button.js" ></script> +<script src="./react_button.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/remote_follow/remote_follow.js b/src/components/remote_follow/remote_follow.js @@ -1,5 +1,5 @@ export default { - props: [ 'user' ], + props: ['user'], computed: { subscribeUrl () { // eslint-disable-next-line no-undef diff --git a/src/components/retweet_button/retweet_button.vue b/src/components/retweet_button/retweet_button.vue @@ -36,7 +36,7 @@ </div> </template> -<script src="./retweet_button.js" ></script> +<script src="./retweet_button.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/search_bar/search_bar.js b/src/components/search_bar/search_bar.js @@ -16,7 +16,7 @@ const SearchBar = { error: false }), watch: { - '$route': function (route) { + $route: function (route) { if (route.name === 'search') { this.searchTerm = route.query.query } diff --git a/src/components/selectable_list/selectable_list.vue b/src/components/selectable_list/selectable_list.vue @@ -24,7 +24,7 @@ :items="items" :get-key="getKey" > - <template v-slot:item="{item}"> + <template #item="{item}"> <div class="selectable-list-item-inner" :class="{ 'selectable-list-item-selected-inner': isSelected(item) }" @@ -41,7 +41,7 @@ /> </div> </template> - <template v-slot:empty> + <template #empty> <slot name="empty" /> </template> </List> diff --git a/src/components/settings_modal/helpers/modified_indicator.vue b/src/components/settings_modal/helpers/modified_indicator.vue @@ -6,14 +6,14 @@ <Popover trigger="hover" > - <template v-slot:trigger> + <template #trigger> &nbsp; <FAIcon icon="wrench" :aria-label="$t('settings.setting_changed')" /> </template> - <template v-slot:content> + <template #content> <div class="modified-tooltip"> {{ $t('settings.setting_changed') }} </div> diff --git a/src/components/settings_modal/helpers/server_side_indicator.vue b/src/components/settings_modal/helpers/server_side_indicator.vue @@ -6,14 +6,14 @@ <Popover trigger="hover" > - <template v-slot:trigger> + <template #trigger> &nbsp; <FAIcon icon="server" :aria-label="$t('settings.setting_server_side')" /> </template> - <template v-slot:content> + <template #content> <div class="serverside-tooltip"> {{ $t('settings.setting_server_side') }} </div> diff --git a/src/components/settings_modal/settings_modal.vue b/src/components/settings_modal/settings_modal.vue @@ -53,7 +53,7 @@ :bound-to="{ x: 'container' }" remove-padding > - <template v-slot:trigger> + <template #trigger> <button class="btn button-default" :title="$t('general.close')" @@ -65,7 +65,7 @@ /> </button> </template> - <template v-slot:content="{close}"> + <template #content="{close}"> <div class="dropdown-menu"> <button class="button-default dropdown-item dropdown-item-icon" diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue @@ -75,12 +75,18 @@ </BooleanSetting> </li> <li> - <BooleanSetting path="userPopoverZoom" expert="1"> + <BooleanSetting + path="userPopoverZoom" + expert="1" + > {{ $t('settings.user_popover_avatar_zoom') }} </BooleanSetting> </li> <li> - <BooleanSetting path="userPopoverOverlay" expert="1"> + <BooleanSetting + path="userPopoverOverlay" + expert="1" + > {{ $t('settings.user_popover_avatar_overlay') }} </BooleanSetting> </li> diff --git a/src/components/settings_modal/tabs/mutes_and_blocks_tab.vue b/src/components/settings_modal/tabs/mutes_and_blocks_tab.vue @@ -10,7 +10,7 @@ :query="queryUserIds" :placeholder="$t('settings.search_user_to_block')" > - <template v-slot="row"> + <template #default="row"> <BlockCard :user-id="row.item" /> @@ -21,7 +21,7 @@ :refresh="true" :get-key="i => i" > - <template v-slot:header="{selected}"> + <template #header="{selected}"> <div class="bulk-actions"> <ProgressButton v-if="selected.length > 0" @@ -29,7 +29,7 @@ :click="() => blockUsers(selected)" > {{ $t('user_card.block') }} - <template v-slot:progress> + <template #progress> {{ $t('user_card.block_progress') }} </template> </ProgressButton> @@ -39,16 +39,16 @@ :click="() => unblockUsers(selected)" > {{ $t('user_card.unblock') }} - <template v-slot:progress> + <template #progress> {{ $t('user_card.unblock_progress') }} </template> </ProgressButton> </div> </template> - <template v-slot:item="{item}"> + <template #item="{item}"> <BlockCard :user-id="item" /> </template> - <template v-slot:empty> + <template #empty> {{ $t('settings.no_blocks') }} </template> </BlockList> @@ -63,7 +63,7 @@ :query="queryUserIds" :placeholder="$t('settings.search_user_to_mute')" > - <template v-slot="row"> + <template #default="row"> <MuteCard :user-id="row.item" /> @@ -74,7 +74,7 @@ :refresh="true" :get-key="i => i" > - <template v-slot:header="{selected}"> + <template #header="{selected}"> <div class="bulk-actions"> <ProgressButton v-if="selected.length > 0" @@ -82,7 +82,7 @@ :click="() => muteUsers(selected)" > {{ $t('user_card.mute') }} - <template v-slot:progress> + <template #progress> {{ $t('user_card.mute_progress') }} </template> </ProgressButton> @@ -92,16 +92,16 @@ :click="() => unmuteUsers(selected)" > {{ $t('user_card.unmute') }} - <template v-slot:progress> + <template #progress> {{ $t('user_card.unmute_progress') }} </template> </ProgressButton> </div> </template> - <template v-slot:item="{item}"> + <template #item="{item}"> <MuteCard :user-id="item" /> </template> - <template v-slot:empty> + <template #empty> {{ $t('settings.no_mutes') }} </template> </MuteList> @@ -114,7 +114,7 @@ :query="queryKnownDomains" :placeholder="$t('settings.type_domains_to_mute')" > - <template v-slot="row"> + <template #default="row"> <DomainMuteCard :domain="row.item" /> @@ -125,7 +125,7 @@ :refresh="true" :get-key="i => i" > - <template v-slot:header="{selected}"> + <template #header="{selected}"> <div class="bulk-actions"> <ProgressButton v-if="selected.length > 0" @@ -133,16 +133,16 @@ :click="() => unmuteDomains(selected)" > {{ $t('domain_mute_card.unmute') }} - <template v-slot:progress> + <template #progress> {{ $t('domain_mute_card.unmute_progress') }} </template> </ProgressButton> </div> </template> - <template v-slot:item="{item}"> + <template #item="{item}"> <DomainMuteCard :domain="item" /> </template> - <template v-slot:empty> + <template #empty> {{ $t('settings.no_mutes') }} </template> </DomainMuteList> diff --git a/src/components/settings_modal/tabs/profile_tab.js b/src/components/settings_modal/tabs/profile_tab.js @@ -71,10 +71,12 @@ const ProfileTab = { }) }, emojiSuggestor () { - return suggestor({ emoji: [ - ...this.$store.state.instance.emoji, - ...this.$store.state.instance.customEmoji - ] }) + return suggestor({ + emoji: [ + ...this.$store.state.instance.emoji, + ...this.$store.state.instance.customEmoji + ] + }) }, userSuggestor () { return suggestor({ store: this.$store }) diff --git a/src/components/settings_modal/tabs/profile_tab.vue b/src/components/settings_modal/tabs/profile_tab.vue @@ -117,8 +117,8 @@ <button v-if="!isDefaultAvatar && pickAvatarBtnVisible" :title="$t('settings.reset_avatar')" - @click="resetAvatar" class="button-unstyled reset-button" + @click="resetAvatar" > <FAIcon icon="times" diff --git a/src/components/settings_modal/tabs/security_tab/mfa.js b/src/components/settings_modal/tabs/security_tab/mfa.js @@ -32,8 +32,8 @@ const Mfa = { components: { 'recovery-codes': RecoveryCodes, 'totp-item': TOTP, - 'qrcode': VueQrcode, - 'confirm': Confirm + qrcode: VueQrcode, + confirm: Confirm }, computed: { canSetupOTP () { @@ -139,7 +139,7 @@ const Mfa = { // fetch settings from server async fetchSettings () { - let result = await this.backendInteractor.settingsMFA() + const result = await this.backendInteractor.settingsMFA() if (result.error) return this.settings = result.settings this.settings.available = true diff --git a/src/components/settings_modal/tabs/security_tab/mfa_totp.js b/src/components/settings_modal/tabs/security_tab/mfa_totp.js @@ -10,7 +10,7 @@ export default { inProgress: false // progress peform request to disable otp method }), components: { - 'confirm': Confirm + confirm: Confirm }, computed: { isActivated () { diff --git a/src/components/settings_modal/tabs/security_tab/security_tab.js b/src/components/settings_modal/tabs/security_tab/security_tab.js @@ -13,7 +13,7 @@ const SecurityTab = { deletingAccount: false, deleteAccountConfirmPasswordInput: '', deleteAccountError: false, - changePasswordInputs: [ '', '', '' ], + changePasswordInputs: ['', '', ''], changedPassword: false, changePasswordError: false, moveAccountTarget: '', diff --git a/src/components/settings_modal/tabs/theme_tab/preview.vue b/src/components/settings_modal/tabs/theme_tab/preview.vue @@ -29,7 +29,10 @@ {{ $t('settings.style.preview.content') }} </h4> - <i18n-t scope="global" keypath="settings.style.preview.text"> + <i18n-t + scope="global" + keypath="settings.style.preview.text" + > <code style="font-family: var(--postCodeFont)"> {{ $t('settings.style.preview.mono') }} </code> diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.js b/src/components/settings_modal/tabs/theme_tab/theme_tab.js @@ -95,11 +95,11 @@ export default { ...Object.keys(SLOT_INHERITANCE) .map(key => [key, '']) - .reduce((acc, [key, val]) => ({ ...acc, [ key + 'ColorLocal' ]: val }), {}), + .reduce((acc, [key, val]) => ({ ...acc, [key + 'ColorLocal']: val }), {}), ...Object.keys(OPACITIES) .map(key => [key, '']) - .reduce((acc, [key, val]) => ({ ...acc, [ key + 'OpacityLocal' ]: val }), {}), + .reduce((acc, [key, val]) => ({ ...acc, [key + 'OpacityLocal']: val }), {}), shadowSelected: undefined, shadowsLocal: {}, @@ -212,12 +212,12 @@ export default { currentColors () { return Object.keys(SLOT_INHERITANCE) .map(key => [key, this[key + 'ColorLocal']]) - .reduce((acc, [key, val]) => ({ ...acc, [ key ]: val }), {}) + .reduce((acc, [key, val]) => ({ ...acc, [key]: val }), {}) }, currentOpacity () { return Object.keys(OPACITIES) .map(key => [key, this[key + 'OpacityLocal']]) - .reduce((acc, [key, val]) => ({ ...acc, [ key ]: val }), {}) + .reduce((acc, [key, val]) => ({ ...acc, [key]: val }), {}) }, currentRadii () { return { diff --git a/src/components/shadow_control/shadow_control.js b/src/components/shadow_control/shadow_control.js @@ -112,9 +112,11 @@ export default { return hex2rgb(this.selected.color) }, style () { - return this.ready ? { - boxShadow: getCssShadow(this.fallback) - } : {} + return this.ready + ? { + boxShadow: getCssShadow(this.fallback) + } + : {} } } } diff --git a/src/components/shadow_control/shadow_control.vue b/src/components/shadow_control/shadow_control.vue @@ -215,7 +215,7 @@ </div> </template> -<script src="./shadow_control.js" ></script> +<script src="./shadow_control.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/shout_panel/shout_panel.js b/src/components/shout_panel/shout_panel.js @@ -11,7 +11,7 @@ library.add( ) const shoutPanel = { - props: [ 'floating' ], + props: ['floating'], data () { return { currentMessage: '', diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js @@ -32,7 +32,7 @@ library.add( ) const SideDrawer = { - props: [ 'logout' ], + props: ['logout'], data: () => ({ closed: true, closeGesture: undefined diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue @@ -204,7 +204,7 @@ </div> </template> -<script src="./side_drawer.js" ></script> +<script src="./side_drawer.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/staff_panel/staff_panel.js b/src/components/staff_panel/staff_panel.js @@ -17,8 +17,8 @@ const StaffPanel = { const groupedStaffAccounts = groupBy(staffAccounts, 'role') return [ - { role: 'admin', users: groupedStaffAccounts['admin'] }, - { role: 'moderator', users: groupedStaffAccounts['moderator'] } + { role: 'admin', users: groupedStaffAccounts.admin }, + { role: 'moderator', users: groupedStaffAccounts.moderator } ].filter(group => group.users) }, ...mapGetters([ diff --git a/src/components/staff_panel/staff_panel.vue b/src/components/staff_panel/staff_panel.vue @@ -24,7 +24,7 @@ </div> </template> -<script src="./staff_panel.js" ></script> +<script src="./staff_panel.js"></script> <style lang="scss"> diff --git a/src/components/status/status.js b/src/components/status/status.js @@ -448,7 +448,7 @@ const Status = { scrollIfHighlighted (highlightId) { const id = highlightId if (this.status.id === id) { - let rect = this.$el.getBoundingClientRect() + const rect = this.$el.getBoundingClientRect() if (rect.top < 100) { // Post is above screen, match its top to screen top window.scrollBy(0, rect.top - 100) @@ -463,7 +463,7 @@ const Status = { } }, watch: { - 'highlight': function (id) { + highlight: function (id) { this.scrollIfHighlighted(id) }, 'status.repeat_num': function (num) { @@ -478,7 +478,7 @@ const Status = { this.$store.dispatch('fetchFavs', this.status.id) } }, - 'isSuspendable': function (val) { + isSuspendable: function (val) { this.suspendable = val } } diff --git a/src/components/status/status.vue b/src/components/status/status.vue @@ -122,10 +122,13 @@ v-if="!noHeading" class="left-side" > - <a :href="$router.resolve(userProfileLink).href" @click.prevent> + <a + :href="$router.resolve(userProfileLink).href" + @click.prevent + > <UserPopover - :userId="status.user.id" - :overlayCenters="true" + :user-id="status.user.id" + :overlay-centers="true" > <UserAvatar class="post-avatar" @@ -488,6 +491,6 @@ </div> </template> -<script src="./status.js" ></script> +<script src="./status.js"></script> <style src="./status.scss" lang="scss"></style> diff --git a/src/components/status_body/status_body.vue b/src/components/status_body/status_body.vue @@ -96,5 +96,5 @@ <slot v-if="!hideSubjectStatus" /> </div> </template> -<script src="./status_body.js" ></script> +<script src="./status_body.js"></script> <style lang="scss" src="./status_body.scss" /> diff --git a/src/components/status_content/status_content.vue b/src/components/status_content/status_content.vue @@ -56,7 +56,7 @@ </div> </template> -<script src="./status_content.js" ></script> +<script src="./status_content.js"></script> <style lang="scss"> .StatusContent { flex: 1; diff --git a/src/components/status_popover/status_popover.vue b/src/components/status_popover/status_popover.vue @@ -1,16 +1,16 @@ <template> <Popover + ref="popover" trigger="hover" :stay-on-click="true" popover-class="popover-default status-popover" :bound-to="{ x: 'container' }" @show="enter" - ref="popover" > - <template v-slot:trigger> + <template #trigger> <slot /> </template> - <template v-slot:content> + <template #content> <Status v-if="status" :is-preview="true" @@ -37,7 +37,7 @@ </Popover> </template> -<script src="./status_popover.js" ></script> +<script src="./status_popover.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/sticker_picker/sticker_picker.js b/src/components/sticker_picker/sticker_picker.js @@ -31,8 +31,8 @@ const StickerPicker = { fetch(sticker) .then((res) => { res.blob().then((blob) => { - var file = new File([blob], name, { mimetype: 'image/png' }) - var formData = new FormData() + const file = new File([blob], name, { mimetype: 'image/png' }) + const formData = new FormData() formData.append('file', file) statusPosterService.uploadMedia({ store, formData }) .then((fileData) => { diff --git a/src/components/terms_of_service_panel/terms_of_service_panel.vue b/src/components/terms_of_service_panel/terms_of_service_panel.vue @@ -13,7 +13,7 @@ </div> </template> -<script src="./terms_of_service_panel.js" ></script> +<script src="./terms_of_service_panel.js"></script> <style lang="scss"> .tos-content { diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue @@ -46,7 +46,10 @@ </div> </div> <div :class="classes.footer"> - <teleport :to="footerSlipgate" :disabled="!embedded || !footerSlipgate"> + <teleport + :to="footerSlipgate" + :disabled="!embedded || !footerSlipgate" + > <div v-if="count===0" class="new-status-notification text-center faint" diff --git a/src/components/timeline/timeline_quick_settings.vue b/src/components/timeline/timeline_quick_settings.vue @@ -4,7 +4,7 @@ class="TimelineQuickSettings" :bound-to="{ x: 'container' }" > - <template v-slot:content> + <template #content> <div class="dropdown-menu"> <div v-if="loggedIn"> <button @@ -80,7 +80,7 @@ </button> </div> </template> - <template v-slot:trigger> + <template #trigger> <button class="button-unstyled"> <FAIcon icon="filter" /> </button> diff --git a/src/components/timeline_menu/timeline_menu.js b/src/components/timeline_menu/timeline_menu.js @@ -11,9 +11,9 @@ library.add(faChevronDown) // because nav panel benefits from the same information. export const timelineNames = () => { return { - 'friends': 'nav.home_timeline', - 'bookmarks': 'nav.bookmarks', - 'dms': 'nav.dms', + friends: 'nav.home_timeline', + bookmarks: 'nav.bookmarks', + dms: 'nav.dms', 'public-timeline': 'nav.public_tl', 'public-external-timeline': 'nav.twkn' } diff --git a/src/components/timeline_menu/timeline_menu.vue b/src/components/timeline_menu/timeline_menu.vue @@ -9,10 +9,10 @@ @show="openMenu" @close="() => isOpen = false" > - <template v-slot:content> + <template #content> <TimelineMenuContent /> </template> - <template v-slot:trigger> + <template #trigger> <span class="button-unstyled title timeline-menu-title"> <span class="timeline-title">{{ timelineName() }}</span> <span> @@ -30,7 +30,7 @@ </Popover> </template> -<script src="./timeline_menu.js" ></script> +<script src="./timeline_menu.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/timeline_menu/timeline_menu_content.vue b/src/components/timeline_menu/timeline_menu_content.vue @@ -63,4 +63,4 @@ </ul> </template> -<script src="./timeline_menu_content.js" ></script> +<script src="./timeline_menu_content.js"></script> diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js @@ -67,7 +67,7 @@ export default { style () { return { backgroundImage: [ - `linear-gradient(to bottom, var(--profileTint), var(--profileTint))`, + 'linear-gradient(to bottom, var(--profileTint), var(--profileTint))', `url(${this.user.cover_photo})` ].join(', ') } diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue @@ -29,10 +29,10 @@ </a> <UserAvatar v-else-if="typeof avatarAction === 'function'" - @click="avatarAction" class="user-info-avatar" :better-shadow="betterShadow" :user="user" + @click="avatarAction" /> <router-link v-else diff --git a/src/components/user_list_popover/user_list_popover.vue b/src/components/user_list_popover/user_list_popover.vue @@ -4,10 +4,10 @@ placement="top" :offset="{ y: 5 }" > - <template v-slot:trigger> + <template #trigger> <slot /> </template> - <template v-slot:content> + <template #content> <div class="user-list-popover"> <template v-if="users.length"> <div @@ -45,7 +45,7 @@ </Popover> </template> -<script src="./user_list_popover.js" ></script> +<script src="./user_list_popover.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/user_popover/user_popover.vue b/src/components/user_popover/user_popover.vue @@ -1,27 +1,27 @@ <template> -<Popover - trigger="click" - popover-class="popover-default user-popover" - :overlay-centers-selector="overlayCentersSelector || '.user-info .Avatar'" - :overlay-centers="overlayCenters && userPopoverOverlay" - :disabled="disabled" -> - <template v-slot:trigger> - <slot /> - </template> - <template v-slot:content={close}> - <UserCard - class="user-popover" - :user-id="userId" - :hide-bio="true" - :avatar-action="userPopoverZoom ? 'zoom' : close" - :on-close="close" - /> - </template> -</Popover> + <Popover + trigger="click" + popover-class="popover-default user-popover" + :overlay-centers-selector="overlayCentersSelector || '.user-info .Avatar'" + :overlay-centers="overlayCenters && userPopoverOverlay" + :disabled="disabled" + > + <template #trigger> + <slot /> + </template> + <template #content="{close}"> + <UserCard + class="user-popover" + :user-id="userId" + :hide-bio="true" + :avatar-action="userPopoverZoom ? 'zoom' : close" + :on-close="close" + /> + </template> + </Popover> </template> -<script src="./user_popover.js" ></script> +<script src="./user_popover.js"></script> <style lang="scss"> @import '../../_variables.scss'; diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue @@ -56,7 +56,7 @@ :user-id="userId" :pinned-status-ids="user.pinnedStatusIds" :in-profile="true" - :footerSlipgate="footerRef" + :footer-slipgate="footerRef" /> <div v-if="followsTabVisible" @@ -65,7 +65,7 @@ :disabled="!user.friends_count" > <FriendList :user-id="userId"> - <template v-slot:item="{item}"> + <template #item="{item}"> <FollowCard :user="item" /> </template> </FriendList> @@ -77,7 +77,7 @@ :disabled="!user.followers_count" > <FollowerList :user-id="userId"> - <template v-slot:item="{item}"> + <template #item="{item}"> <FollowCard :user="item" :no-follows-you="isUs" @@ -95,7 +95,7 @@ :timeline="media" :user-id="userId" :in-profile="true" - :footerSlipgate="footerRef" + :footer-slipgate="footerRef" /> <Timeline v-if="isUs" @@ -107,10 +107,13 @@ timeline-name="favorites" :timeline="favorites" :in-profile="true" - :footerSlipgate="footerRef" + :footer-slipgate="footerRef" /> </tab-switcher> - <div class="panel-footer" :ref="setFooterRef"></div> + <div + :ref="setFooterRef" + class="panel-footer" + /> </div> <div v-else diff --git a/src/components/user_reporting_modal/user_reporting_modal.vue b/src/components/user_reporting_modal/user_reporting_modal.vue @@ -45,7 +45,7 @@ </div> <div class="user-reporting-panel-right"> <List :items="statuses"> - <template v-slot:item="{item}"> + <template #item="{item}"> <div class="status-fadein user-reporting-panel-sitem"> <Status :in-conversation="false" diff --git a/src/components/who_to_follow/who_to_follow.js b/src/components/who_to_follow/who_to_follow.js @@ -28,7 +28,7 @@ const WhoToFollow = { getWhoToFollow () { const credentials = this.$store.state.users.currentUser.credentials if (credentials) { - apiService.suggestions({ credentials: credentials }) + apiService.suggestions({ credentials }) .then((reply) => { this.showWhoToFollow(reply) }) diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.js b/src/components/who_to_follow_panel/who_to_follow_panel.js @@ -6,9 +6,9 @@ function showWhoToFollow (panel, reply) { const shuffled = shuffle(reply) panel.usersToFollow.forEach((toFollow, index) => { - let user = shuffled[index] - let img = user.avatar || this.$store.state.instance.defaultAvatar - let name = user.acct + const user = shuffled[index] + const img = user.avatar || this.$store.state.instance.defaultAvatar + const name = user.acct toFollow.img = img toFollow.name = name @@ -24,12 +24,12 @@ function showWhoToFollow (panel, reply) { } function getWhoToFollow (panel) { - var credentials = panel.$store.state.users.currentUser.credentials + const credentials = panel.$store.state.users.currentUser.credentials if (credentials) { panel.usersToFollow.forEach(toFollow => { toFollow.name = 'Loading...' }) - apiService.suggestions({ credentials: credentials }) + apiService.suggestions({ credentials }) .then((reply) => { showWhoToFollow(panel, reply) }) diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.vue b/src/components/who_to_follow_panel/who_to_follow_panel.vue @@ -27,7 +27,7 @@ </div> </template> -<script src="./who_to_follow_panel.js" ></script> +<script src="./who_to_follow_panel.js"></script> <style lang="scss"> .who-to-follow * { diff --git a/src/i18n/messages.js b/src/i18n/messages.js @@ -46,7 +46,7 @@ const messages = { }, setLanguage: async (i18n, language) => { if (loaders[language]) { - let messages = await loaders[language]() + const messages = await loaders[language]() i18n.setLocaleMessage(language, messages.default) } i18n.locale = language diff --git a/src/lib/notification-i18n-loader.js b/src/lib/notification-i18n-loader.js @@ -3,8 +3,8 @@ // meant to be used to load the partial i18n we need for // the service worker. module.exports = function (source) { - var object = JSON.parse(source) - var smol = { + const object = JSON.parse(source) + const smol = { notifications: object.notifications || {} } diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js @@ -5,10 +5,12 @@ import { each, get, set, cloneDeep } from 'lodash' let loaded = false const defaultReducer = (state, paths) => ( - paths.length === 0 ? state : paths.reduce((substate, path) => { - set(substate, path, get(state, path)) - return substate - }, {}) + paths.length === 0 + ? state + : paths.reduce((substate, path) => { + set(substate, path, get(state, path)) + return substate + }, {}) ) const saveImmedeatelyActions = [ @@ -30,7 +32,7 @@ export default function createPersistedState ({ key = 'vuex-lz', paths = [], getState = (key, storage) => { - let value = storage.getItem(key) + const value = storage.getItem(key) return value }, setState = (key, state, storage) => { diff --git a/src/modules/api.js b/src/modules/api.js @@ -233,7 +233,7 @@ const api = { // Follow requests startFetchingFollowRequests (store) { - if (store.state.fetchers['followRequests']) return + if (store.state.fetchers.followRequests) return const fetcher = store.state.backendInteractor.startFetchingFollowRequests({ store }) store.commit('addFetcher', { fetcherName: 'followRequests', fetcher }) @@ -244,7 +244,7 @@ const api = { store.commit('removeFetcher', { fetcherName: 'followRequests', fetcher }) }, removeFollowRequest (store, request) { - let requests = store.state.followRequests.filter((it) => it !== request) + const requests = store.state.followRequests.filter((it) => it !== request) store.commit('setFollowRequests', requests) }, diff --git a/src/modules/config.js b/src/modules/config.js @@ -147,7 +147,7 @@ const config = { const knownKeys = new Set(Object.keys(defaultState)) const presentKeys = new Set(Object.keys(data)) const intersection = new Set() - for (let elem of presentKeys) { + for (const elem of presentKeys) { if (knownKeys.has(elem)) { intersection.add(elem) } diff --git a/src/modules/errors.js b/src/modules/errors.js @@ -2,8 +2,8 @@ import { capitalize } from 'lodash' export function humanizeErrors (errors) { return Object.entries(errors).reduce((errs, [k, val]) => { - let message = val.reduce((acc, message) => { - let key = capitalize(k.replace(/_/g, ' ')) + const message = val.reduce((acc, message) => { + const key = capitalize(k.replace(/_/g, ' ')) return acc + [key, message].join(' ') + '. ' }, '') return [...errs, message] diff --git a/src/modules/serverSideConfig.js b/src/modules/serverSideConfig.js @@ -39,53 +39,53 @@ const notificationsApi = ({ rootState, commit }, { path, value, oldValue }) => { * If no api is specified, defaultApi is used (see above) */ export const settingsMap = { - 'defaultScope': 'source.privacy', - 'defaultNSFW': 'source.sensitive', // BROKEN: pleroma/pleroma#2837 - 'stripRichContent': { + defaultScope: 'source.privacy', + defaultNSFW: 'source.sensitive', // BROKEN: pleroma/pleroma#2837 + stripRichContent: { get: 'source.pleroma.no_rich_text', set: 'no_rich_text' }, // Privacy - 'locked': 'locked', - 'acceptChatMessages': { + locked: 'locked', + acceptChatMessages: { get: 'pleroma.accepts_chat_messages', set: 'accepts_chat_messages' }, - 'allowFollowingMove': { + allowFollowingMove: { get: 'pleroma.allow_following_move', set: 'allow_following_move' }, - 'discoverable': { + discoverable: { get: 'source.pleroma.discoverable', set: 'discoverable' }, - 'hideFavorites': { + hideFavorites: { get: 'pleroma.hide_favorites', set: 'hide_favorites' }, - 'hideFollowers': { + hideFollowers: { get: 'pleroma.hide_followers', set: 'hide_followers' }, - 'hideFollows': { + hideFollows: { get: 'pleroma.hide_follows', set: 'hide_follows' }, - 'hideFollowersCount': { + hideFollowersCount: { get: 'pleroma.hide_followers_count', set: 'hide_followers_count' }, - 'hideFollowsCount': { + hideFollowsCount: { get: 'pleroma.hide_follows_count', set: 'hide_follows_count' }, // NotificationSettingsAPIs - 'webPushHideContents': { + webPushHideContents: { get: 'pleroma.notification_settings.hide_notification_contents', set: 'hide_notification_contents', api: notificationsApi }, - 'blockNotificationsFromStrangers': { + blockNotificationsFromStrangers: { get: 'pleroma.notification_settings.block_from_strangers', set: 'block_from_strangers', api: notificationsApi diff --git a/src/modules/statuses.js b/src/modules/statuses.js @@ -245,10 +245,10 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us } const processors = { - 'status': (status) => { + status: (status) => { addStatus(status, showImmediately) }, - 'retweet': (status) => { + retweet: (status) => { // RetweetedStatuses are never shown immediately const retweetedStatus = addStatus(status.retweeted_status, false, false) @@ -270,7 +270,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us retweet.retweeted_status = retweetedStatus }, - 'favorite': (favorite) => { + favorite: (favorite) => { // Only update if this is a new favorite. // Ignore our own favorites because we get info about likes as response to like request if (!state.favorites.has(favorite.id)) { @@ -278,7 +278,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us favoriteStatus(favorite) } }, - 'deletion': (deletion) => { + deletion: (deletion) => { const uri = deletion.uri const status = find(allStatuses, { uri }) if (!status) { @@ -292,10 +292,10 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us remove(timelineObject.visibleStatuses, { uri }) } }, - 'follow': (follow) => { + follow: (follow) => { // NOOP, it is known status but we don't do anything about it for now }, - 'default': (unknown) => { + default: (unknown) => { console.log('unknown status type') console.log(unknown) } @@ -303,7 +303,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us each(statuses, (status) => { const type = status.type - const processor = processors[type] || processors['default'] + const processor = processors[type] || processors.default processor(status) }) @@ -522,7 +522,7 @@ export const mutations = { }, addEmojiReactionsBy (state, { id, emojiReactions, currentUser }) { const status = state.allStatusesObject[id] - status['emoji_reactions'] = emojiReactions + status.emoji_reactions = emojiReactions }, addOwnReaction (state, { id, emoji, currentUser }) { const status = state.allStatusesObject[id] @@ -543,7 +543,7 @@ export const mutations = { if (reactionIndex >= 0) { status.emoji_reactions[reactionIndex] = newReaction } else { - status['emoji_reactions'] = [...status.emoji_reactions, newReaction] + status.emoji_reactions = [...status.emoji_reactions, newReaction] } }, removeOwnReaction (state, { id, emoji, currentUser }) { @@ -564,7 +564,7 @@ export const mutations = { if (newReaction.count > 0) { status.emoji_reactions[reactionIndex] = newReaction } else { - status['emoji_reactions'] = status.emoji_reactions.filter(r => r.name !== emoji) + status.emoji_reactions = status.emoji_reactions.filter(r => r.name !== emoji) } }, updateStatusWithPoll (state, { id, poll }) { diff --git a/src/modules/users.js b/src/modules/users.js @@ -103,23 +103,23 @@ export const mutations = { const user = state.usersObject[id] const tags = user.tags || [] const newTags = tags.concat([tag]) - user['tags'] = newTags + user.tags = newTags }, untagUser (state, { user: { id }, tag }) { const user = state.usersObject[id] const tags = user.tags || [] const newTags = tags.filter(t => t !== tag) - user['tags'] = newTags + user.tags = newTags }, updateRight (state, { user: { id }, right, value }) { const user = state.usersObject[id] - let newRights = user.rights + const newRights = user.rights newRights[right] = value - user['rights'] = newRights + user.rights = newRights }, updateActivationStatus (state, { user: { id }, deactivated }) { const user = state.usersObject[id] - user['deactivated'] = deactivated + user.deactivated = deactivated }, setCurrentUser (state, user) { state.lastLoginName = user.screen_name @@ -148,13 +148,13 @@ export const mutations = { clearFriends (state, userId) { const user = state.usersObject[userId] if (user) { - user['friendIds'] = [] + user.friendIds = [] } }, clearFollowers (state, userId) { const user = state.usersObject[userId] if (user) { - user['followerIds'] = [] + user.followerIds = [] } }, addNewUsers (state, users) { @@ -222,7 +222,7 @@ export const mutations = { }, setColor (state, { user: { id }, highlighted }) { const user = state.usersObject[id] - user['highlight'] = highlighted + user.highlight = highlighted }, signUpPending (state) { state.signUpPending = true @@ -393,7 +393,7 @@ const users = { toggleActivationStatus ({ rootState, commit }, { user }) { const api = user.deactivated ? rootState.api.backendInteractor.activateUser : rootState.api.backendInteractor.deactivateUser api({ user }) - .then((user) => { let deactivated = !user.is_active; commit('updateActivationStatus', { user, deactivated }) }) + .then((user) => { const deactivated = !user.is_active; commit('updateActivationStatus', { user, deactivated }) }) }, registerPushNotifications (store) { const token = store.state.currentUser.credentials @@ -457,17 +457,17 @@ const users = { async signUp (store, userInfo) { store.commit('signUpPending') - let rootState = store.rootState + const rootState = store.rootState try { - let data = await rootState.api.backendInteractor.register( + const data = await rootState.api.backendInteractor.register( { params: { ...userInfo } } ) store.commit('signUpSuccess') store.commit('setToken', data.access_token) store.dispatch('loginUser', data.access_token) } catch (e) { - let errors = e.message + const errors = e.message store.commit('signUpFailure', errors) throw e } diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js @@ -76,7 +76,7 @@ const MASTODON_PIN_OWN_STATUS = id => `/api/v1/statuses/${id}/pin` const MASTODON_UNPIN_OWN_STATUS = id => `/api/v1/statuses/${id}/unpin` const MASTODON_MUTE_CONVERSATION = id => `/api/v1/statuses/${id}/mute` const MASTODON_UNMUTE_CONVERSATION = id => `/api/v1/statuses/${id}/unmute` -const MASTODON_SEARCH_2 = `/api/v2/search` +const MASTODON_SEARCH_2 = '/api/v2/search' const MASTODON_USER_SEARCH_URL = '/api/v1/accounts/search' const MASTODON_DOMAIN_BLOCKS_URL = '/api/v1/domain_blocks' const MASTODON_STREAMING = '/api/v1/streaming' @@ -84,7 +84,7 @@ const MASTODON_KNOWN_DOMAIN_LIST_URL = '/api/v1/instance/peers' const PLEROMA_EMOJI_REACTIONS_URL = id => `/api/v1/pleroma/statuses/${id}/reactions` const PLEROMA_EMOJI_REACT_URL = (id, emoji) => `/api/v1/pleroma/statuses/${id}/reactions/${emoji}` const PLEROMA_EMOJI_UNREACT_URL = (id, emoji) => `/api/v1/pleroma/statuses/${id}/reactions/${emoji}` -const PLEROMA_CHATS_URL = `/api/v1/pleroma/chats` +const PLEROMA_CHATS_URL = '/api/v1/pleroma/chats' const PLEROMA_CHAT_URL = id => `/api/v1/pleroma/chats/by-account-id/${id}` const PLEROMA_CHAT_MESSAGES_URL = id => `/api/v1/pleroma/chats/${id}/messages` const PLEROMA_CHAT_READ_URL = id => `/api/v1/pleroma/chats/${id}/read` @@ -93,7 +93,7 @@ const PLEROMA_BACKUP_URL = '/api/v1/pleroma/backups' const oldfetch = window.fetch -let fetch = (url, options) => { +const fetch = (url, options) => { options = options || {} const baseUrl = '' const fullUrl = baseUrl + url @@ -105,7 +105,7 @@ const promisedRequest = ({ method, url, params, payload, credentials, headers = const options = { method, headers: { - 'Accept': 'application/json', + Accept: 'application/json', 'Content-Type': 'application/json', ...headers } @@ -229,16 +229,16 @@ const getCaptcha = () => fetch('/api/pleroma/captcha').then(resp => resp.json()) const authHeaders = (accessToken) => { if (accessToken) { - return { 'Authorization': `Bearer ${accessToken}` } + return { Authorization: `Bearer ${accessToken}` } } else { return { } } } const followUser = ({ id, credentials, ...options }) => { - let url = MASTODON_FOLLOW_URL(id) + const url = MASTODON_FOLLOW_URL(id) const form = {} - if (options.reblogs !== undefined) { form['reblogs'] = options.reblogs } + if (options.reblogs !== undefined) { form.reblogs = options.reblogs } return fetch(url, { body: JSON.stringify(form), headers: { @@ -250,7 +250,7 @@ const followUser = ({ id, credentials, ...options }) => { } const unfollowUser = ({ id, credentials }) => { - let url = MASTODON_UNFOLLOW_URL(id) + const url = MASTODON_UNFOLLOW_URL(id) return fetch(url, { headers: authHeaders(credentials), method: 'POST' @@ -292,7 +292,7 @@ const unblockUser = ({ id, credentials }) => { } const approveUser = ({ id, credentials }) => { - let url = MASTODON_APPROVE_USER_URL(id) + const url = MASTODON_APPROVE_USER_URL(id) return fetch(url, { headers: authHeaders(credentials), method: 'POST' @@ -300,7 +300,7 @@ const approveUser = ({ id, credentials }) => { } const denyUser = ({ id, credentials }) => { - let url = MASTODON_DENY_USER_URL(id) + const url = MASTODON_DENY_USER_URL(id) return fetch(url, { headers: authHeaders(credentials), method: 'POST' @@ -308,13 +308,13 @@ const denyUser = ({ id, credentials }) => { } const fetchUser = ({ id, credentials }) => { - let url = `${MASTODON_USER_URL}/${id}` + const url = `${MASTODON_USER_URL}/${id}` return promisedRequest({ url, credentials }) .then((data) => parseUser(data)) } const fetchUserRelationship = ({ id, credentials }) => { - let url = `${MASTODON_USER_RELATIONSHIPS_URL}/?id=${id}` + const url = `${MASTODON_USER_RELATIONSHIPS_URL}/?id=${id}` return fetch(url, { headers: authHeaders(credentials) }) .then((response) => { return new Promise((resolve, reject) => response.json() @@ -333,7 +333,7 @@ const fetchFriends = ({ id, maxId, sinceId, limit = 20, credentials }) => { maxId && `max_id=${maxId}`, sinceId && `since_id=${sinceId}`, limit && `limit=${limit}`, - `with_relationships=true` + 'with_relationships=true' ].filter(_ => _).join('&') url = url + (args ? '?' + args : '') @@ -368,7 +368,7 @@ const fetchFollowers = ({ id, maxId, sinceId, limit = 20, credentials }) => { maxId && `max_id=${maxId}`, sinceId && `since_id=${sinceId}`, limit && `limit=${limit}`, - `with_relationships=true` + 'with_relationships=true' ].filter(_ => _).join('&') url += args ? '?' + args : '' @@ -385,7 +385,7 @@ const fetchFollowRequests = ({ credentials }) => { } const fetchConversation = ({ id, credentials }) => { - let urlContext = MASTODON_STATUS_CONTEXT_URL(id) + const urlContext = MASTODON_STATUS_CONTEXT_URL(id) return fetch(urlContext, { headers: authHeaders(credentials) }) .then((data) => { if (data.ok) { @@ -401,7 +401,7 @@ const fetchConversation = ({ id, credentials }) => { } const fetchStatus = ({ id, credentials }) => { - let url = MASTODON_STATUS_URL(id) + const url = MASTODON_STATUS_URL(id) return fetch(url, { headers: authHeaders(credentials) }) .then((data) => { if (data.ok) { @@ -425,7 +425,7 @@ const tagUser = ({ tag, credentials, user }) => { return fetch(TAG_USER_URL, { method: 'PUT', - headers: headers, + headers, body: JSON.stringify(form) }) } @@ -442,7 +442,7 @@ const untagUser = ({ tag, credentials, user }) => { return fetch(TAG_USER_URL, { method: 'DELETE', - headers: headers, + headers, body: JSON.stringify(body) }) } @@ -495,7 +495,7 @@ const deleteUser = ({ credentials, user }) => { return fetch(`${ADMIN_USERS_URL}?nickname=${screenName}`, { method: 'DELETE', - headers: headers + headers }) } @@ -514,7 +514,7 @@ const fetchTimeline = ({ friends: MASTODON_USER_HOME_TIMELINE_URL, dms: MASTODON_DIRECT_MESSAGES_TIMELINE_URL, notifications: MASTODON_USER_NOTIFICATIONS_URL, - 'publicAndExternal': MASTODON_PUBLIC_TIMELINE, + publicAndExternal: MASTODON_PUBLIC_TIMELINE, user: MASTODON_USER_TIMELINE_URL, media: MASTODON_USER_TIMELINE_URL, favorites: MASTODON_USER_FAVORITES_TIMELINE_URL, @@ -688,7 +688,7 @@ const postStatus = ({ form.append('preview', 'true') } - let postHeaders = authHeaders(credentials) + const postHeaders = authHeaders(credentials) if (idempotencyKey) { postHeaders['idempotency-key'] = idempotencyKey } @@ -993,7 +993,7 @@ const vote = ({ pollId, choices, credentials }) => { method: 'POST', credentials, payload: { - choices: choices + choices } }) } @@ -1053,8 +1053,8 @@ const reportUser = ({ credentials, userId, statusIds, comment, forward }) => { url: MASTODON_REPORT_USER_URL, method: 'POST', payload: { - 'account_id': userId, - 'status_ids': statusIds, + account_id: userId, + status_ids: statusIds, comment, forward }, @@ -1076,7 +1076,7 @@ const searchUsers = ({ credentials, query }) => { const search2 = ({ credentials, q, resolve, limit, offset, following }) => { let url = MASTODON_SEARCH_2 - let params = [] + const params = [] if (q) { params.push(['q', encodeURIComponent(q)]) @@ -1100,7 +1100,7 @@ const search2 = ({ credentials, q, resolve, limit, offset, following }) => { params.push(['with_relationships', true]) - let queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&') + const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&') url += `?${queryString}` return fetch(url, { headers: authHeaders(credentials) }) @@ -1254,12 +1254,12 @@ export const handleMastoWS = (wsEvent) => { } export const WSConnectionStatus = Object.freeze({ - 'JOINED': 1, - 'CLOSED': 2, - 'ERROR': 3, - 'DISABLED': 4, - 'STARTING': 5, - 'STARTING_INITIAL': 6 + JOINED: 1, + CLOSED: 2, + ERROR: 3, + DISABLED: 4, + STARTING: 5, + STARTING_INITIAL: 6 }) const chats = ({ credentials }) => { @@ -1297,11 +1297,11 @@ const chatMessages = ({ id, credentials, maxId, sinceId, limit = 20 }) => { const sendChatMessage = ({ id, content, mediaId = null, idempotencyKey, credentials }) => { const payload = { - 'content': content + content } if (mediaId) { - payload['media_id'] = mediaId + payload.media_id = mediaId } const headers = {} @@ -1313,7 +1313,7 @@ const sendChatMessage = ({ id, content, mediaId = null, idempotencyKey, credenti return promisedRequest({ url: PLEROMA_CHAT_MESSAGES_URL(id), method: 'POST', - payload: payload, + payload, credentials, headers }) @@ -1324,7 +1324,7 @@ const readChat = ({ id, lastReadId, credentials }) => { url: PLEROMA_CHAT_READ_URL(id), method: 'POST', payload: { - 'last_read_id': lastReadId + last_read_id: lastReadId }, credentials }) diff --git a/src/services/chat_service/chat_service.js b/src/services/chat_service/chat_service.js @@ -7,7 +7,7 @@ const empty = (chatId) => { messages: [], newMessageCount: 0, lastSeenMessageId: '0', - chatId: chatId, + chatId, minId: undefined, maxId: undefined } @@ -101,7 +101,7 @@ const add = (storage, { messages: newMessages, updateMaxId = true }) => { storage.messages = storage.messages.filter(msg => msg.id !== message.id) } Object.assign(fakeMessage, message, { error: false }) - delete fakeMessage['fakeId'] + delete fakeMessage.fakeId storage.idIndex[fakeMessage.id] = fakeMessage delete storage.idIndex[message.fakeId] @@ -178,7 +178,7 @@ const getView = (storage) => { id: date.getTime().toString() }) - previousMessage['isTail'] = true + previousMessage.isTail = true currentMessageChainId = undefined afterDate = true } @@ -193,15 +193,15 @@ const getView = (storage) => { // end a message chian if ((nextMessage && nextMessage.account_id) !== message.account_id) { - object['isTail'] = true + object.isTail = true currentMessageChainId = undefined } // start a new message chain if ((previousMessage && previousMessage.data && previousMessage.data.account_id) !== message.account_id || afterDate) { currentMessageChainId = _.uniqueId() - object['isHead'] = true - object['messageChainId'] = currentMessageChainId + object.isHead = true + object.messageChainId = currentMessageChainId } result.push(object) diff --git a/src/services/chat_utils/chat_utils.js b/src/services/chat_utils/chat_utils.js @@ -25,7 +25,7 @@ export const buildFakeMessage = ({ content, chatId, attachments, userId, idempot chat_id: chatId, created_at: new Date(), id: `${new Date().getTime()}`, - attachments: attachments, + attachments, account_id: userId, idempotency_key: idempotencyKey, emojis: [], diff --git a/src/services/color_convert/color_convert.js b/src/services/color_convert/color_convert.js @@ -144,11 +144,13 @@ export const invert = (rgb) => { */ export const hex2rgb = (hex) => { const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex) - return result ? { - r: parseInt(result[1], 16), - g: parseInt(result[2], 16), - b: parseInt(result[3], 16) - } : null + return result + ? { + r: parseInt(result[1], 16), + g: parseInt(result[2], 16), + b: parseInt(result[3], 16) + } + : null } /** diff --git a/src/services/completion/completion.js b/src/services/completion/completion.js @@ -35,7 +35,7 @@ export const addPositionToWords = (words) => { } export const splitByWhitespaceBoundary = (str) => { - let result = [] + const result = [] let currentWord = '' for (let i = 0; i < str.length; i++) { const currentChar = str[i] diff --git a/src/services/date_utils/date_utils.js b/src/services/date_utils/date_utils.js @@ -10,7 +10,7 @@ export const relativeTime = (date, nowThreshold = 1) => { if (typeof date === 'string') date = Date.parse(date) const round = Date.now() > date ? Math.floor : Math.ceil const d = Math.abs(Date.now() - date) - let r = { num: round(d / YEAR), key: 'time.unit.years' } + const r = { num: round(d / YEAR), key: 'time.unit.years' } if (d < nowThreshold * SECOND) { r.num = 0 r.key = 'time.now' diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js @@ -371,8 +371,8 @@ export const parseStatus = (data) => { export const parseNotification = (data) => { const mastoDict = { - 'favourite': 'like', - 'reblog': 'repeat' + favourite: 'like', + reblog: 'repeat' } const masto = !data.hasOwnProperty('ntype') const output = {} diff --git a/src/services/file_size_format/file_size_format.js b/src/services/file_size_format/file_size_format.js @@ -1,7 +1,7 @@ const fileSizeFormat = (num) => { - var exponent - var unit - var units = ['B', 'KiB', 'MiB', 'GiB', 'TiB'] + let exponent + let unit + const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB'] if (num < 1) { return num + ' ' + units[0] } @@ -9,7 +9,7 @@ const fileSizeFormat = (num) => { exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1) num = (num / Math.pow(1024, exponent)).toFixed(2) * 1 unit = units[exponent] - return { num: num, unit: unit } + return { num, unit } } const fileSizeFormatService = { fileSizeFormat diff --git a/src/services/html_converter/html_line_converter.service.js b/src/services/html_converter/html_line_converter.service.js @@ -46,7 +46,7 @@ export const convertHtmlToLines = (html = '') => { // All block-level elements that aren't empty elements, i.e. not <hr> const nonEmptyElements = new Set(visualLineElements) // Difference - for (let elem of emptyElements) { + for (const elem of emptyElements) { nonEmptyElements.delete(elem) } @@ -56,7 +56,7 @@ export const convertHtmlToLines = (html = '') => { ...emptyElements.values() ]) - let buffer = [] // Current output buffer + const buffer = [] // Current output buffer const level = [] // How deep we are in tags and which tags were there let textBuffer = '' // Current line content let tagBuffer = null // Current tag buffer, if null = we are not currently reading a tag diff --git a/src/services/html_converter/utility.service.js b/src/services/html_converter/utility.service.js @@ -50,7 +50,7 @@ export const processTextForEmoji = (text, emojis, processor) => { if (char === ':') { const next = text.slice(i + 1) let found = false - for (let emoji of emojis) { + for (const emoji of emojis) { if (next.slice(0, emoji.shortcode.length + 1) === (emoji.shortcode + ':')) { found = emoji break diff --git a/src/services/locale/locale.service.js b/src/services/locale/locale.service.js @@ -3,9 +3,9 @@ import ISO6391 from 'iso-639-1' import _ from 'lodash' const specialLanguageCodes = { - 'ja_easy': 'ja', - 'zh_Hant': 'zh-HANT', - 'zh': 'zh-Hans' + ja_easy: 'ja', + zh_Hant: 'zh-HANT', + zh: 'zh-Hans' } const internalToBrowserLocale = code => specialLanguageCodes[code] || code @@ -14,16 +14,16 @@ const internalToBackendLocale = code => internalToBrowserLocale(code).replace('_ const getLanguageName = (code) => { const specialLanguageNames = { - 'ja_easy': 'やさしいにほんご', - 'zh': '简体中文', - 'zh_Hant': '繁體中文' + ja_easy: 'やさしいにほんご', + zh: '简体中文', + zh_Hant: '繁體中文' } const languageName = specialLanguageNames[code] || ISO6391.getNativeName(code) const browserLocale = internalToBrowserLocale(code) return languageName.charAt(0).toLocaleUpperCase(browserLocale) + languageName.slice(1) } -const languages = _.map(languagesObject.languages, (code) => ({ code: code, name: getLanguageName(code) })).sort((a, b) => a.name.localeCompare(b.name)) +const languages = _.map(languagesObject.languages, (code) => ({ code, name: getLanguageName(code) })).sort((a, b) => a.name.localeCompare(b.name)) const localeService = { internalToBrowserLocale, diff --git a/src/services/new_api/password_reset.js b/src/services/new_api/password_reset.js @@ -1,6 +1,6 @@ import { reduce } from 'lodash' -const MASTODON_PASSWORD_RESET_URL = `/auth/password` +const MASTODON_PASSWORD_RESET_URL = '/auth/password' const resetPassword = ({ instance, email }) => { const params = { email } diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -12,20 +12,20 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => { const timelineData = rootState.statuses.notifications const hideMutedPosts = getters.mergedConfig.hideMutedPosts - args['withMuted'] = !hideMutedPosts + args.withMuted = !hideMutedPosts - args['timeline'] = 'notifications' + args.timeline = 'notifications' if (older) { if (timelineData.minId !== Number.POSITIVE_INFINITY) { - args['until'] = timelineData.minId + args.until = timelineData.minId } return fetchNotifications({ store, args, older }) } else { // fetch new notifications if (since === undefined && timelineData.maxId !== Number.POSITIVE_INFINITY) { - args['since'] = timelineData.maxId + args.since = timelineData.maxId } else if (since !== null) { - args['since'] = since + args.since = since } const result = fetchNotifications({ store, args, older }) @@ -38,7 +38,7 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => { const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id) const numUnseenNotifs = notifications.length - readNotifsIds.length if (numUnseenNotifs > 0 && readNotifsIds.length > 0) { - args['since'] = Math.max(...readNotifsIds) + args.since = Math.max(...readNotifsIds) fetchNotifications({ store, args, older }) } diff --git a/src/services/push/push.js b/src/services/push/push.js @@ -43,7 +43,7 @@ function deleteSubscriptionFromBackEnd (token) { method: 'DELETE', headers: { 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` + Authorization: `Bearer ${token}` } }).then((response) => { if (!response.ok) throw new Error('Bad status code from server.') @@ -56,7 +56,7 @@ function sendSubscriptionToBackEnd (subscription, token, notificationVisibility) method: 'POST', headers: { 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` + Authorization: `Bearer ${token}` }, body: JSON.stringify({ subscription, diff --git a/src/services/theme_data/theme_data.service.js b/src/services/theme_data/theme_data.service.js @@ -39,7 +39,7 @@ import { LAYERS, DEFAULT_OPACITY, SLOT_INHERITANCE } from './pleromafe.js' export const CURRENT_VERSION = 3 export const getLayersArray = (layer, data = LAYERS) => { - let array = [layer] + const array = [layer] let parent = data[layer] while (parent) { array.unshift(parent) diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -34,20 +34,20 @@ const fetchAndUpdate = ({ const loggedIn = !!rootState.users.currentUser if (older) { - args['until'] = until || timelineData.minId + args.until = until || timelineData.minId } else { if (since === undefined) { - args['since'] = timelineData.maxId + args.since = timelineData.maxId } else if (since !== null) { - args['since'] = since + args.since = since } } - args['userId'] = userId - args['tag'] = tag - args['withMuted'] = !hideMutedPosts + args.userId = userId + args.tag = tag + args.withMuted = !hideMutedPosts if (loggedIn && ['friends', 'public', 'publicAndExternal'].includes(timeline)) { - args['replyVisibility'] = replyVisibility + args.replyVisibility = replyVisibility } const numStatusesBeforeFetch = timelineData.statuses.length @@ -60,7 +60,7 @@ const fetchAndUpdate = ({ const { data: statuses, pagination } = response if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) { - store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId }) + store.dispatch('queueFlush', { timeline, id: timelineData.maxId }) } update({ store, statuses, timeline, showImmediately, userId, pagination }) return { statuses, pagination } diff --git a/src/services/user_highlighter/user_highlighter.js b/src/services/user_highlighter/user_highlighter.js @@ -36,7 +36,7 @@ const highlightStyle = (prefs) => { 'linear-gradient(to right,', `${solidColor} ,`, `${solidColor} 2px,`, - `transparent 6px` + 'transparent 6px' ].join(' '), backgroundPosition: '0 0', ...customProps diff --git a/src/sw.js b/src/sw.js @@ -57,8 +57,8 @@ self.addEventListener('notificationclick', (event) => { event.notification.close() event.waitUntil(getWindowClients().then((list) => { - for (var i = 0; i < list.length; i++) { - var client = list[i] + for (let i = 0; i < list.length; i++) { + const client = list[i] if (client.url === '/' && 'focus' in client) { return client.focus() } } diff --git a/test/e2e/custom-assertions/elementCount.js b/test/e2e/custom-assertions/elementCount.js @@ -16,7 +16,7 @@ exports.assertion = function (selector, count) { return res.value } this.command = function (cb) { - var self = this + const self = this return this.api.execute(function (selector) { return document.querySelectorAll(selector).length }, [selector], function (res) { diff --git a/test/e2e/nightwatch.conf.js b/test/e2e/nightwatch.conf.js @@ -1,45 +1,45 @@ require('@babel/register') -var config = require('../../config') +const config = require('../../config') // http://nightwatchjs.org/guide#settings-file module.exports = { - 'src_folders': ['test/e2e/specs'], - 'output_folder': 'test/e2e/reports', - 'custom_assertions_path': ['test/e2e/custom-assertions'], + src_folders: ['test/e2e/specs'], + output_folder: 'test/e2e/reports', + custom_assertions_path: ['test/e2e/custom-assertions'], - 'selenium': { - 'start_process': true, - 'server_path': 'node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.1.jar', - 'host': '127.0.0.1', - 'port': 4444, - 'cli_args': { + selenium: { + start_process: true, + server_path: 'node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.1.jar', + host: '127.0.0.1', + port: 4444, + cli_args: { 'webdriver.chrome.driver': require('chromedriver').path } }, - 'test_settings': { - 'default': { - 'selenium_port': 4444, - 'selenium_host': 'localhost', - 'silent': true, - 'globals': { - 'devServerURL': 'http://localhost:' + (process.env.PORT || config.dev.port) + test_settings: { + default: { + selenium_port: 4444, + selenium_host: 'localhost', + silent: true, + globals: { + devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) } }, - 'chrome': { - 'desiredCapabilities': { - 'browserName': 'chrome', - 'javascriptEnabled': true, - 'acceptSslCerts': true + chrome: { + desiredCapabilities: { + browserName: 'chrome', + javascriptEnabled: true, + acceptSslCerts: true } }, - 'firefox': { - 'desiredCapabilities': { - 'browserName': 'firefox', - 'javascriptEnabled': true, - 'acceptSslCerts': true + firefox: { + desiredCapabilities: { + browserName: 'firefox', + javascriptEnabled: true, + acceptSslCerts: true } } } diff --git a/test/e2e/runner.js b/test/e2e/runner.js @@ -1,6 +1,6 @@ // 1. start the dev server using production config process.env.NODE_ENV = 'testing' -var server = require('../../build/dev-server.js') +const server = require('../../build/dev-server.js') // 2. run the nightwatch test suite against it // to run in additional browsers: @@ -9,7 +9,7 @@ var server = require('../../build/dev-server.js') // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` // For more information on Nightwatch's config file, see // http://nightwatchjs.org/guide#settings-file -var opts = process.argv.slice(2) +let opts = process.argv.slice(2) if (opts.indexOf('--config') === -1) { opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) } @@ -17,8 +17,8 @@ if (opts.indexOf('--env') === -1) { opts = opts.concat(['--env', 'chrome']) } -var spawn = require('cross-spawn') -var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) +const spawn = require('cross-spawn') +const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) runner.on('exit', function (code) { server.close() diff --git a/test/unit/karma.conf.js b/test/unit/karma.conf.js @@ -4,14 +4,14 @@ // https://github.com/webpack/karma-webpack // var path = require('path') -var merge = require('webpack-merge') -var HtmlWebpackPlugin = require('html-webpack-plugin') -var baseConfig = require('../../build/webpack.base.conf') -var utils = require('../../build/utils') -var webpack = require('webpack') +const merge = require('webpack-merge') +const HtmlWebpackPlugin = require('html-webpack-plugin') +const baseConfig = require('../../build/webpack.base.conf') +const utils = require('../../build/utils') +const webpack = require('webpack') // var projectRoot = path.resolve(__dirname, '../../') -var webpackConfig = merge(baseConfig, { +const webpackConfig = merge(baseConfig, { // use inline sourcemap for karma-sourcemap-loader module: { rules: utils.styleLoaders() @@ -63,7 +63,7 @@ module.exports = function (config) { frameworks: ['mocha', 'sinon-chai'], reporters: ['mocha'], customLaunchers: { - 'FirefoxHeadless': { + FirefoxHeadless: { base: 'Firefox', flags: [ '-headless' diff --git a/test/unit/specs/components/emoji_input.spec.js b/test/unit/specs/components/emoji_input.spec.js @@ -29,7 +29,7 @@ const generateInput = (value, padEmoji = true) => { modelValue: value }, slots: { - 'default': () => h('input', '') + default: () => h('input', '') } }) return wrapper diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js @@ -4,7 +4,7 @@ import RichContent from 'src/components/rich_content/rich_content.jsx' const attentions = [] const global = { mocks: { - '$store': { + $store: { state: {}, getters: { mergedConfig: () => ({ diff --git a/test/unit/specs/components/user_profile.spec.js b/test/unit/specs/components/user_profile.spec.js @@ -163,7 +163,7 @@ const localProfileStore = createStore({ currentUser: { credentials: '' }, - usersObject: { 100: localUser, 'testuser': localUser }, + usersObject: { 100: localUser, testuser: localUser }, users: [localUser], relationships: {} } @@ -175,7 +175,7 @@ describe.skip('UserProfile', () => { it('renders external profile', () => { const wrapper = mount(UserProfile, { global: { - plugins: [ externalProfileStore ], + plugins: [externalProfileStore], mocks: { $route: { params: { id: 100 }, @@ -192,7 +192,7 @@ describe.skip('UserProfile', () => { it('renders local profile', () => { const wrapper = mount(UserProfile, { global: { - plugins: [ localProfileStore ], + plugins: [localProfileStore], mocks: { $route: { params: { name: 'testUser' }, diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js @@ -245,7 +245,7 @@ describe('Statuses module', () => { it('increments count in existing reaction', () => { const state = defaultState() const status = makeMockStatus({ id: '1' }) - status.emoji_reactions = [ { name: '😂', count: 1, accounts: [] } ] + status.emoji_reactions = [{ name: '😂', count: 1, accounts: [] }] mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' }) mutations.addOwnReaction(state, { id: '1', emoji: '😂', currentUser: { id: 'me' } }) @@ -269,7 +269,7 @@ describe('Statuses module', () => { it('decreases count in existing reaction', () => { const state = defaultState() const status = makeMockStatus({ id: '1' }) - status.emoji_reactions = [ { name: '😂', count: 2, accounts: [{ id: 'me' }] } ] + status.emoji_reactions = [{ name: '😂', count: 2, accounts: [{ id: 'me' }] }] mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' }) mutations.removeOwnReaction(state, { id: '1', emoji: '😂', currentUser: { id: 'me' } }) diff --git a/test/unit/specs/services/chat_service/chat_service.spec.js b/test/unit/specs/services/chat_service/chat_service.spec.js @@ -24,23 +24,23 @@ describe('chatService', () => { describe('.add', () => { it("Doesn't add duplicates", () => { const chat = chatService.empty() - chatService.add(chat, { messages: [ message1 ] }) - chatService.add(chat, { messages: [ message1 ] }) + chatService.add(chat, { messages: [message1] }) + chatService.add(chat, { messages: [message1] }) expect(chat.messages.length).to.eql(1) - chatService.add(chat, { messages: [ message2 ] }) + chatService.add(chat, { messages: [message2] }) expect(chat.messages.length).to.eql(2) }) it('Updates minId and lastMessage and newMessageCount', () => { const chat = chatService.empty() - chatService.add(chat, { messages: [ message1 ] }) + chatService.add(chat, { messages: [message1] }) expect(chat.maxId).to.eql(message1.id) expect(chat.minId).to.eql(message1.id) expect(chat.newMessageCount).to.eql(1) - chatService.add(chat, { messages: [ message2 ] }) + chatService.add(chat, { messages: [message2] }) expect(chat.maxId).to.eql(message2.id) expect(chat.minId).to.eql(message1.id) expect(chat.newMessageCount).to.eql(2) @@ -50,7 +50,7 @@ describe('chatService', () => { expect(chat.lastSeenMessageId).to.eql(message2.id) // Add message with higher id - chatService.add(chat, { messages: [ message3 ] }) + chatService.add(chat, { messages: [message3] }) expect(chat.newMessageCount).to.eql(1) }) }) @@ -59,9 +59,9 @@ describe('chatService', () => { it('Updates minId and lastMessage', () => { const chat = chatService.empty() - chatService.add(chat, { messages: [ message1 ] }) - chatService.add(chat, { messages: [ message2 ] }) - chatService.add(chat, { messages: [ message3 ] }) + chatService.add(chat, { messages: [message1] }) + chatService.add(chat, { messages: [message2] }) + chatService.add(chat, { messages: [message3] }) expect(chat.maxId).to.eql(message3.id) expect(chat.minId).to.eql(message1.id) @@ -80,9 +80,9 @@ describe('chatService', () => { it('Inserts date separators', () => { const chat = chatService.empty() - chatService.add(chat, { messages: [ message1 ] }) - chatService.add(chat, { messages: [ message2 ] }) - chatService.add(chat, { messages: [ message3 ] }) + chatService.add(chat, { messages: [message1] }) + chatService.add(chat, { messages: [message2] }) + chatService.add(chat, { messages: [message3] }) const view = chatService.getView(chat) expect(view.map(i => i.type)).to.eql(['date', 'message', 'message', 'date', 'message']) diff --git a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js @@ -314,8 +314,8 @@ describe('API Entities normalizer', () => { const linkHeader = '<https://example.com/api/v1/notifications?max_id=861676>; rel="next", <https://example.com/api/v1/notifications?min_id=861741>; rel="prev"' const result = parseLinkHeaderPagination(linkHeader) expect(result).to.eql({ - 'maxId': 861676, - 'minId': 861741 + maxId: 861676, + minId: 861741 }) }) @@ -323,8 +323,8 @@ describe('API Entities normalizer', () => { const linkHeader = '<http://example.com/api/v1/timelines/home?max_id=9waQx5IIS48qVue2Ai>; rel="next", <http://example.com/api/v1/timelines/home?min_id=9wi61nIPnfn674xgie>; rel="prev"' const result = parseLinkHeaderPagination(linkHeader, { flakeId: true }) expect(result).to.eql({ - 'maxId': '9waQx5IIS48qVue2Ai', - 'minId': '9wi61nIPnfn674xgie' + maxId: '9waQx5IIS48qVue2Ai', + minId: '9wi61nIPnfn674xgie' }) }) }) diff --git a/test/unit/specs/services/file_size_format/file_size_format.spec.js b/test/unit/specs/services/file_size_format/file_size_format.spec.js @@ -25,8 +25,8 @@ describe('fileSizeFormat', () => { } ] - var res = [] - for (var value in values) { + const res = [] + for (const value in values) { res.push(fileSizeFormatService.fileSizeFormat(values[value])) } expect(res).to.eql(expected)