From f19284357e94968cdc9d4034c5e33ef9d6f6d9d7 Mon Sep 17 00:00:00 2001 From: shpuld Date: Thu, 14 Mar 2019 17:46:04 +0200 Subject: make nav bar slide, move mobile post status to mobile nav --- src/components/mobile_nav/mobile_nav.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index a79aa636..88fab656 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -1,11 +1,13 @@ import SideDrawer from '../side_drawer/side_drawer.vue' import Notifications from '../notifications/notifications.vue' +import MobilePostStatusModal from '../mobile_post_status_modal/mobile_post_status_modal.vue' import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils' const MobileNav = { components: { SideDrawer, - Notifications + Notifications, + MobilePostStatusModal }, data: () => ({ notificationsOpen: false @@ -25,9 +27,19 @@ const MobileNav = { }, toggleMobileNotifications () { this.notificationsOpen = !this.notificationsOpen + if (!this.notificationsOpen) { + this.markNotificationsAsSeen() + } }, scrollToTop () { window.scrollTo(0, 0) + }, + logout () { + this.$router.replace('/main/public') + this.$store.dispatch('logout') + }, + markNotificationsAsSeen () { + this.$refs.notifications.markAsSeen() } } } -- cgit v1.2.3-70-g09d2 From 0a86d39ba9cf48fc0b4fb6d91b0d5eff404b2a66 Mon Sep 17 00:00:00 2001 From: shpuld Date: Thu, 14 Mar 2019 20:40:56 +0200 Subject: remove notifications from sidebar, make notifications appear on login only --- src/components/mobile_nav/mobile_nav.js | 3 +++ src/components/mobile_nav/mobile_nav.vue | 6 +++--- src/components/side_drawer/side_drawer.vue | 5 ----- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index 88fab656..fd373ac1 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -13,6 +13,9 @@ const MobileNav = { notificationsOpen: false }), computed: { + currentUser () { + return this.$store.state.users.currentUser + }, unseenNotifications () { return unseenNotificationsFromStore(this.$store) }, diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index af2d6d5a..cb1aaa46 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -8,18 +8,18 @@ {{sitename}}
- Notifications + {{$t('notifications.notifications')}}
-
+
diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue index 95ee21b4..27db12d7 100644 --- a/src/components/side_drawer/side_drawer.vue +++ b/src/components/side_drawer/side_drawer.vue @@ -20,11 +20,6 @@ {{ $t("login.login") }} -
  • - - {{ $t("notifications.notifications") }} {{ unseenNotificationsCount > 0 ? `(${unseenNotificationsCount})` : '' }} - -
  • {{ $t("nav.dms") }} -- cgit v1.2.3-70-g09d2 From 85584021fb1042a8934945d73f7d25b38f1c29d1 Mon Sep 17 00:00:00 2001 From: shpuld Date: Sat, 23 Mar 2019 22:03:38 +0200 Subject: make notifications close on navigation --- src/components/mobile_nav/mobile_nav.js | 18 +++++++++++++++--- src/components/mobile_nav/mobile_nav.vue | 4 ++-- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index fd373ac1..c1f5c2a9 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -28,9 +28,14 @@ const MobileNav = { toggleMobileSidebar () { this.$refs.sideDrawer.toggleDrawer() }, - toggleMobileNotifications () { - this.notificationsOpen = !this.notificationsOpen - if (!this.notificationsOpen) { + openMobileNotifications () { + this.notificationsOpen = true + }, + closeMobileNotifications () { + if (this.notificationsOpen) { + // make sure to mark notifs seen only when the notifs were open and not + // from close-calls. + this.notificationsOpen = false this.markNotificationsAsSeen() } }, @@ -44,6 +49,13 @@ const MobileNav = { markNotificationsAsSeen () { this.$refs.notifications.markAsSeen() } + }, + watch: { + $route () { + // handles closing notificaitons when you press any router-link on the + // notifications. + this.closeMobileNotifications() + } } } diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index 514931f0..39622fad 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -8,7 +8,7 @@ {{sitename}}
  • - +
    @@ -18,7 +18,7 @@
    {{$t('notifications.notifications')}} - +
    -- cgit v1.2.3-70-g09d2 From c06bcf3303d89aa44ddcdad3a9d2f723303ae3d1 Mon Sep 17 00:00:00 2001 From: shpuld Date: Thu, 28 Mar 2019 22:54:45 +0200 Subject: add gesture to close notifications drawer --- src/components/mobile_nav/mobile_nav.js | 15 +++++++++++++++ src/components/mobile_nav/mobile_nav.vue | 9 +++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index c1f5c2a9..bc63d2ba 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -2,6 +2,7 @@ import SideDrawer from '../side_drawer/side_drawer.vue' import Notifications from '../notifications/notifications.vue' import MobilePostStatusModal from '../mobile_post_status_modal/mobile_post_status_modal.vue' import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils' +import GestureService from '../../services/gesture_service/gesture_service' const MobileNav = { components: { @@ -10,8 +11,16 @@ const MobileNav = { MobilePostStatusModal }, data: () => ({ + notificationsCloseGesture: undefined, notificationsOpen: false }), + created () { + this.notificationsCloseGesture = GestureService.swipeGesture( + GestureService.DIRECTION_RIGHT, + this.closeMobileNotifications, + 50 + ) + }, computed: { currentUser () { return this.$store.state.users.currentUser @@ -39,6 +48,12 @@ const MobileNav = { this.markNotificationsAsSeen() } }, + notificationsTouchStart (e) { + GestureService.beginSwipe(e, this.notificationsCloseGesture) + }, + notificationsTouchMove (e) { + GestureService.updateSwipe(e, this.notificationsCloseGesture) + }, scrollToTop () { window.scrollTo(0, 0) }, diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index 39622fad..5fa41638 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -1,5 +1,5 @@ -- cgit v1.2.3-70-g09d2 From 0be86304d24a5f11a64e9120c8ae1ce9121e64e8 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 6 Oct 2019 23:28:30 +0300 Subject: Fix tests, more replacing with mergedConfig --- src/App.js | 4 ++-- src/components/attachment/attachment.js | 8 ++++---- src/components/emoji_input/emoji_input.js | 2 +- src/components/gallery/gallery.js | 2 +- .../interface_language_switcher.vue | 2 +- src/components/mobile_nav/mobile_nav.js | 2 +- .../mobile_post_status_button.js | 2 +- src/components/notification/notification.js | 2 +- src/components/post_status_form/post_status_form.js | 2 +- src/components/settings/settings.js | 2 +- src/components/still-image/still-image.js | 2 +- src/components/style_switcher/style_switcher.js | 8 ++++---- src/components/timeline/timeline.js | 6 +++--- src/components/user_card/user_card.js | 12 ++++++------ src/components/video_attachment/video_attachment.js | 8 ++++---- .../notifications_fetcher.service.js | 5 ++--- .../timeline_fetcher/timeline_fetcher.service.js | 16 ++++++++++++---- test/unit/specs/components/emoji_input.spec.js | 4 ++-- test/unit/specs/components/user_profile.spec.js | 16 ++++++++-------- 19 files changed, 56 insertions(+), 49 deletions(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/App.js b/src/App.js index fe63b54c..04a40e30 100644 --- a/src/App.js +++ b/src/App.js @@ -45,7 +45,7 @@ export default { }), created () { // Load the locale from the storage - this.$i18n.locale = this.$store.state.config.interfaceLanguage + this.$i18n.locale = this.$store.getters.mergedConfig.interfaceLanguage window.addEventListener('resize', this.updateMobileState) }, destroyed () { @@ -93,7 +93,7 @@ export default { suggestionsEnabled () { return this.$store.state.instance.suggestionsEnabled }, showInstanceSpecificPanel () { return this.$store.state.instance.showInstanceSpecificPanel && - !this.$store.state.config.hideISP && + !this.$store.getters.mergedConfig.hideISP && this.$store.state.instance.instanceSpecificPanelContent }, showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel }, diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index e93921fe..21cd0351 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -15,8 +15,8 @@ const Attachment = { data () { return { nsfwImage: this.$store.state.instance.nsfwCensorImage || nsfwImage, - hideNsfwLocal: this.$store.state.config.hideNsfw, - preloadImage: this.$store.state.config.preloadImage, + hideNsfwLocal: this.$store.getters.mergedConfig.hideNsfw, + preloadImage: this.$store.getters.mergedConfig.preloadImage, loading: false, img: fileTypeService.fileType(this.attachment.mimetype) === 'image' && document.createElement('img'), modalOpen: false, @@ -57,7 +57,7 @@ const Attachment = { } }, openModal (event) { - const modalTypes = this.$store.state.config.playVideosInModal + const modalTypes = this.$store.getters.mergedConfig.playVideosInModal ? ['image', 'video'] : ['image'] if (fileTypeService.fileMatchesSomeType(modalTypes, this.attachment) || @@ -70,7 +70,7 @@ const Attachment = { } }, toggleHidden (event) { - if (this.$store.state.config.useOneClickNsfw && !this.showHidden) { + if (this.$store.getters.mergedConfig.useOneClickNsfw && !this.showHidden) { this.openModal(event) return } diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index a586b819..366951c0 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -99,7 +99,7 @@ const EmojiInput = { }, computed: { padEmoji () { - return this.$store.state.config.padEmoji + return this.$store.getters.mergedConfig.padEmoji }, suggestions () { const firstchar = this.textAtCaret.charAt(0) diff --git a/src/components/gallery/gallery.js b/src/components/gallery/gallery.js index 7f33a81b..96ac1b93 100644 --- a/src/components/gallery/gallery.js +++ b/src/components/gallery/gallery.js @@ -37,7 +37,7 @@ const Gallery = { return itemsPerRow => ({ 'height': `${(this.width / (itemsPerRow + 0.6))}px` }) }, useContainFit () { - return this.$store.state.config.useContainFit + return this.$store.getters.mergedConfig.useContainFit } }, methods: { diff --git a/src/components/interface_language_switcher/interface_language_switcher.vue b/src/components/interface_language_switcher/interface_language_switcher.vue index 83df9a0b..1ca22001 100644 --- a/src/components/interface_language_switcher/interface_language_switcher.vue +++ b/src/components/interface_language_switcher/interface_language_switcher.vue @@ -40,7 +40,7 @@ export default { }, language: { - get: function () { return this.$store.state.config.interfaceLanguage }, + get: function () { return this.$store.getters.mergedConfig.interfaceLanguage }, set: function (val) { this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val }) this.$i18n.locale = val diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index c2bb76ee..5a90c31f 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -63,7 +63,7 @@ const MobileNav = { this.$refs.notifications.markAsSeen() }, onScroll ({ target: { scrollTop, clientHeight, scrollHeight } }) { - if (this.$store.state.config.autoLoad && scrollTop + clientHeight >= scrollHeight) { + if (this.$store.getters.mergedConfig.autoLoad && scrollTop + clientHeight >= scrollHeight) { this.$refs.notifications.fetchOlderNotifications() } } diff --git a/src/components/mobile_post_status_button/mobile_post_status_button.js b/src/components/mobile_post_status_button/mobile_post_status_button.js index 3e77148a..0ad12bb1 100644 --- a/src/components/mobile_post_status_button/mobile_post_status_button.js +++ b/src/components/mobile_post_status_button/mobile_post_status_button.js @@ -30,7 +30,7 @@ const MobilePostStatusButton = { return this.autohideFloatingPostButton && (this.hidden || this.inputActive) }, autohideFloatingPostButton () { - return !!this.$store.state.config.autohideFloatingPostButton + return !!this.$store.getters.mergedConfig.autohideFloatingPostButton } }, watch: { diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 8e817f3b..7d46eb5a 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -39,7 +39,7 @@ const Notification = { return highlightClass(this.notification.from_profile) }, userStyle () { - const highlight = this.$store.state.config.highlight + const highlight = this.$store.getters.mergedConfig.highlight const user = this.notification.from_profile return highlightStyle(highlight[user.screen_name]) }, diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 46afc79c..db501dc1 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -152,7 +152,7 @@ const PostStatusForm = { this.$store.state.instance.pollLimits.max_options >= 2 }, hideScopeNotice () { - return this.$store.state.config.hideScopeNotice + return this.$store.getters.mergedConfig.hideScopeNotice }, pollContentError () { return this.pollFormVisible && diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js index a327ab28..98ceb164 100644 --- a/src/components/settings/settings.js +++ b/src/components/settings/settings.js @@ -99,7 +99,7 @@ const settings = { handler (value) { this.$store.dispatch('setOption', { name: 'notificationVisibility', - value: this.$store.state.config.notificationVisibility + value: this.$store.getters.mergedConfig.notificationVisibility }) }, deep: true diff --git a/src/components/still-image/still-image.js b/src/components/still-image/still-image.js index 02e98f19..a5559d5d 100644 --- a/src/components/still-image/still-image.js +++ b/src/components/still-image/still-image.js @@ -7,7 +7,7 @@ const StillImage = { ], data () { return { - stopGifs: this.$store.state.config.stopGifs + stopGifs: this.$store.getters.mergedConfig.stopGifs } }, computed: { diff --git a/src/components/style_switcher/style_switcher.js b/src/components/style_switcher/style_switcher.js index 8c3d4861..c19aaaec 100644 --- a/src/components/style_switcher/style_switcher.js +++ b/src/components/style_switcher/style_switcher.js @@ -27,7 +27,7 @@ export default { data () { return { availableStyles: [], - selected: this.$store.state.config.theme, + selected: this.$store.getters.mergedConfig.theme, previewShadows: {}, previewColors: {}, @@ -111,7 +111,7 @@ export default { }) }, mounted () { - this.normalizeLocalState(this.$store.state.config.customTheme) + this.normalizeLocalState(this.$store.getters.mergedConfig.customTheme) if (typeof this.shadowSelected === 'undefined') { this.shadowSelected = this.shadowsAvailable[0] } @@ -365,9 +365,9 @@ export default { return version >= 1 || version <= 2 }, clearAll () { - const state = this.$store.state.config.customTheme + const state = this.$store.getters.mergedConfig.customTheme const version = state.colors ? 2 : 'l1' - this.normalizeLocalState(this.$store.state.config.customTheme, version) + this.normalizeLocalState(this.$store.getters.mergedConfig.customTheme, version) }, // Clears all the extra stuff when loading V1 theme diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 0594576c..27a9a55e 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -141,7 +141,7 @@ const Timeline = { const bodyBRect = document.body.getBoundingClientRect() const height = Math.max(bodyBRect.height, -(bodyBRect.y)) if (this.timeline.loading === false && - this.$store.state.config.autoLoad && + this.$store.getters.mergedConfig.autoLoad && this.$el.offsetHeight > 0 && (window.innerHeight + window.pageYOffset) >= (height - 750)) { this.fetchOlderStatuses() @@ -153,7 +153,7 @@ const Timeline = { }, watch: { newStatusCount (count) { - if (!this.$store.state.config.streaming) { + if (!this.$store.getters.mergedConfig.streaming) { return } if (count > 0) { @@ -162,7 +162,7 @@ const Timeline = { const top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0) if (top < 15 && !this.paused && - !(this.unfocused && this.$store.state.config.pauseOnUnfocused) + !(this.unfocused && this.$store.getters.mergedConfig.pauseOnUnfocused) ) { this.showNewStatuses() } else { diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 12f9f9e8..c84afe77 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -27,9 +27,9 @@ export default { }] }, style () { - const color = this.$store.state.config.customTheme.colors - ? this.$store.state.config.customTheme.colors.bg // v2 - : this.$store.state.config.colors.bg // v1 + const color = this.$store.getters.mergedConfig.customTheme.colors + ? this.$store.getters.mergedConfig.customTheme.colors.bg // v2 + : this.$store.getters.mergedConfig.colors.bg // v1 if (color) { const rgb = (typeof color === 'string') ? hex2rgb(color) : color @@ -61,11 +61,11 @@ export default { }, userHighlightType: { get () { - const data = this.$store.state.config.highlight[this.user.screen_name] + const data = this.$store.getters.mergedConfig.highlight[this.user.screen_name] return (data && data.type) || 'disabled' }, set (type) { - const data = this.$store.state.config.highlight[this.user.screen_name] + const data = this.$store.getters.mergedConfig.highlight[this.user.screen_name] if (type !== 'disabled') { this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: (data && data.color) || '#FFFFFF', type }) } else { @@ -76,7 +76,7 @@ export default { }, userHighlightColor: { get () { - const data = this.$store.state.config.highlight[this.user.screen_name] + const data = this.$store.getters.mergedConfig.highlight[this.user.screen_name] return data && data.color }, set (color) { diff --git a/src/components/video_attachment/video_attachment.js b/src/components/video_attachment/video_attachment.js index 76b19a02..f0ca7e89 100644 --- a/src/components/video_attachment/video_attachment.js +++ b/src/components/video_attachment/video_attachment.js @@ -3,7 +3,7 @@ const VideoAttachment = { props: ['attachment', 'controls'], data () { return { - loopVideo: this.$store.state.config.loopVideo + loopVideo: this.$store.getters.mergedConfig.loopVideo } }, methods: { @@ -12,16 +12,16 @@ const VideoAttachment = { if (typeof target.webkitAudioDecodedByteCount !== 'undefined') { // non-zero if video has audio track if (target.webkitAudioDecodedByteCount > 0) { - this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly + this.loopVideo = this.loopVideo && !this.$store.getters.mergedConfig.loopVideoSilentOnly } } else if (typeof target.mozHasAudio !== 'undefined') { // true if video has audio track if (target.mozHasAudio) { - this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly + this.loopVideo = this.loopVideo && !this.$store.getters.mergedConfig.loopVideoSilentOnly } } else if (typeof target.audioTracks !== 'undefined') { if (target.audioTracks.length > 0) { - this.loopVideo = this.loopVideo && !this.$store.state.config.loopVideoSilentOnly + this.loopVideo = this.loopVideo && !this.$store.getters.mergedConfig.loopVideoSilentOnly } } } diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index b6c4cf80..47008026 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -8,11 +8,10 @@ const update = ({ store, notifications, older }) => { const fetchAndUpdate = ({ store, credentials, older = false }) => { const args = { credentials } + const { getters } = store const rootState = store.rootState || store.state const timelineData = rootState.statuses.notifications - const hideMutedPosts = typeof rootState.config.hideMutedPosts === 'undefined' - ? rootState.instance.hideMutedPosts - : rootState.config.hideMutedPosts + const hideMutedPosts = getters.mergedConfig.hideMutedPosts args['withMuted'] = !hideMutedPosts diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index f72688f8..9eb30c2d 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -15,13 +15,21 @@ const update = ({ store, statuses, timeline, showImmediately, userId }) => { }) } -const fetchAndUpdate = ({ store, credentials, timeline = 'friends', older = false, showImmediately = false, userId = false, tag = false, until }) => { +const fetchAndUpdate = ({ + store, + credentials, + timeline = 'friends', + older = false, + showImmediately = false, + userId = false, + tag = false, + until +}) => { const args = { timeline, credentials } const rootState = store.rootState || store.state + const { getters } = store const timelineData = rootState.statuses.timelines[camelCase(timeline)] - const hideMutedPosts = typeof rootState.config.hideMutedPosts === 'undefined' - ? rootState.instance.hideMutedPosts - : rootState.config.hideMutedPosts + const hideMutedPosts = getters.mergedConfig.hideMutedPosts if (older) { args['until'] = until || timelineData.minId diff --git a/test/unit/specs/components/emoji_input.spec.js b/test/unit/specs/components/emoji_input.spec.js index 368d623d..b1b98802 100644 --- a/test/unit/specs/components/emoji_input.spec.js +++ b/test/unit/specs/components/emoji_input.spec.js @@ -12,8 +12,8 @@ const generateInput = (value, padEmoji = true) => { }, mocks: { $store: { - state: { - config: { + getters: { + mergedConfig: { padEmoji } } diff --git a/test/unit/specs/components/user_profile.spec.js b/test/unit/specs/components/user_profile.spec.js index 6de9491a..1b6a47d7 100644 --- a/test/unit/specs/components/user_profile.spec.js +++ b/test/unit/specs/components/user_profile.spec.js @@ -18,7 +18,14 @@ const actions = { } const testGetters = { - findUser: state => getters.findUser(state.users) + findUser: state => getters.findUser(state.users), + mergedConfig: state => ({ + colors: '', + highlight: {}, + customTheme: { + colors: [] + } + }) } const localUser = { @@ -45,13 +52,6 @@ const externalProfileStore = new Vuex.Store({ interface: { browserSupport: '' }, - config: { - colors: '', - highlight: {}, - customTheme: { - colors: [] - } - }, instance: { hideUserStats: true }, -- cgit v1.2.3-70-g09d2 From d0c78989aa9e5f5142dbc09a8935c004a2050257 Mon Sep 17 00:00:00 2001 From: taehoon Date: Sun, 1 Dec 2019 19:34:01 -0500 Subject: hide instance url/link/text in header using hideSitename option --- src/App.js | 1 + src/App.vue | 1 + src/boot/after_store.js | 1 + src/components/mobile_nav/mobile_nav.js | 1 + src/components/mobile_nav/mobile_nav.vue | 1 + src/components/side_drawer/side_drawer.js | 3 +++ src/components/side_drawer/side_drawer.vue | 2 +- src/modules/instance.js | 1 + 8 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/App.js b/src/App.js index 04a40e30..78ff29da 100644 --- a/src/App.js +++ b/src/App.js @@ -90,6 +90,7 @@ export default { }, sitename () { return this.$store.state.instance.name }, chat () { return this.$store.state.chat.channel.state === 'joined' }, + hideSitename () { return this.$store.state.instance.hideSitename }, suggestionsEnabled () { return this.$store.state.instance.suggestionsEnabled }, showInstanceSpecificPanel () { return this.$store.state.instance.showInstanceSpecificPanel && diff --git a/src/App.vue b/src/App.vue index dbe842ec..c66df843 100644 --- a/src/App.vue +++ b/src/App.vue @@ -31,6 +31,7 @@
    { copyInstanceOption('alwaysShowSubjectInput') copyInstanceOption('noAttachmentLinks') copyInstanceOption('showFeaturesPanel') + copyInstanceOption('hideSitename') return store.dispatch('setTheme', config['theme']) } diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index 5a90c31f..c1166a0c 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -29,6 +29,7 @@ const MobileNav = { unseenNotificationsCount () { return this.unseenNotifications.length }, + hideSitename () { return this.$store.state.instance.hideSitename }, sitename () { return this.$store.state.instance.name } }, methods: { diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index d1c24e56..51f1d636 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -17,6 +17,7 @@ - {{ sitename }} + {{ sitename }}
      diff --git a/src/modules/instance.js b/src/modules/instance.js index 96f14ed5..625323b9 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -27,6 +27,7 @@ const defaultState = { scopeCopy: true, subjectLineBehavior: 'email', postContentType: 'text/plain', + hideSitename: false, nsfwCensorImage: undefined, vapidPublicKey: undefined, noAttachmentLinks: false, -- cgit v1.2.3-70-g09d2