diff --git a/changelog.d/zoomlag.skip b/changelog.d/zoomlag.skip new file mode 100644 index 000000000..e69de29bb diff --git a/src/App.scss b/src/App.scss index 1b3133a7c..d56306c9e 100644 --- a/src/App.scss +++ b/src/App.scss @@ -679,11 +679,6 @@ option { } } -.btn-block { - display: block; - width: 100%; -} - .btn-group { position: relative; display: inline-flex; diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 65c4c9205..3ef92fd11 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -254,6 +254,7 @@ const getNodeInfo = async ({ store }) => { const data = await res.json() const metadata = data.metadata const features = metadata.features + console.log(features) store.dispatch('setInstanceOption', { name: 'name', value: metadata.nodeName }) store.dispatch('setInstanceOption', { name: 'registrationOpen', value: data.openRegistrations }) store.dispatch('setInstanceOption', { name: 'mediaProxyAvailable', value: features.includes('media_proxy') }) @@ -274,6 +275,7 @@ const getNodeInfo = async ({ store }) => { store.dispatch('setInstanceOption', { name: 'mailerEnabled', value: metadata.mailerEnabled }) store.dispatch('setInstanceOption', { name: 'quotingAvailable', value: features.includes('quote_posting') }) store.dispatch('setInstanceOption', { name: 'groupActorAvailable', value: features.includes('pleroma:group_actors') }) + store.dispatch('setInstanceOption', { name: 'blockExpiration', value: features.includes('pleroma:block_expiration') }) store.dispatch('setInstanceOption', { name: 'localBubbleInstances', value: metadata.localBubbleInstances ?? [] }) const uploadLimits = metadata.uploadLimits diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js index 9a63f57eb..f8ad0e11b 100644 --- a/src/components/account_actions/account_actions.js +++ b/src/components/account_actions/account_actions.js @@ -3,6 +3,7 @@ import ProgressButton from '../progress_button/progress_button.vue' import Popover from '../popover/popover.vue' import UserListMenu from 'src/components/user_list_menu/user_list_menu.vue' import ConfirmModal from '../confirm_modal/confirm_modal.vue' +import UserTimedFilterModal from 'src/components/user_timed_filter_modal/user_timed_filter_modal.vue' import { library } from '@fortawesome/fontawesome-svg-core' import { faEllipsisV @@ -27,15 +28,10 @@ const AccountActions = { ProgressButton, Popover, UserListMenu, - ConfirmModal + ConfirmModal, + UserTimedFilterModal }, methods: { - showConfirmBlock () { - this.showingConfirmBlock = true - }, - hideConfirmBlock () { - this.showingConfirmBlock = false - }, showConfirmRemoveUserFromFollowers () { this.showingConfirmRemoveFollower = true }, @@ -49,10 +45,14 @@ const AccountActions = { this.$store.dispatch('hideReblogs', this.user.id) }, blockUser () { - if (!this.shouldConfirmBlock) { - this.doBlockUser() + if (this.$refs.timedBlockDialog) { + this.$refs.timedBlockDialog.optionallyPrompt() } else { - this.showConfirmBlock() + if (!this.shouldConfirmBlock) { + this.doBlockUser() + } else { + this.showingConfirmBlock = true + } } }, doBlockUser () { @@ -91,6 +91,7 @@ const AccountActions = { return this.$store.getters.mergedConfig.modalOnRemoveUserFromFollowers }, ...mapState({ + blockExpirationSupported: state => state.instance.blockExpiration, pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable }) } diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue index fd4837ee4..f3cca45d0 100644 --- a/src/components/account_actions/account_actions.vue +++ b/src/components/account_actions/account_actions.vue @@ -96,7 +96,8 @@ + diff --git a/src/components/block_card/block_card.js b/src/components/block_card/block_card.js index 0bf4e37bc..360cfe740 100644 --- a/src/components/block_card/block_card.js +++ b/src/components/block_card/block_card.js @@ -1,12 +1,9 @@ +import { mapState } from 'vuex' + import BasicUserCard from '../basic_user_card/basic_user_card.vue' const BlockCard = { props: ['userId'], - data () { - return { - progress: false - } - }, computed: { user () { return this.$store.getters.findUser(this.userId) @@ -16,7 +13,16 @@ const BlockCard = { }, blocked () { return this.relationship.blocking - } + }, + blockExpiry () { + console.log(this.user) + return this.user.block_expires_at == null + ? this.$t('user_card.block_expires_forever') + : this.$t('user_card.block_expires_at', [new Date(this.user.mute_expires_at).toLocaleString()]) + }, + ...mapState({ + blockExpirationSupported: state => state.instance.blockExpiration, + }) }, components: { BasicUserCard @@ -24,15 +30,14 @@ const BlockCard = { methods: { unblockUser () { this.progress = true - this.$store.dispatch('unblockUser', this.user.id).then(() => { - this.progress = false - }) + this.$store.dispatch('unblockUser', this.user.id) }, blockUser () { - this.progress = true - this.$store.dispatch('blockUser', this.user.id).then(() => { - this.progress = false - }) + if (this.blockExpirationSupported) { + this.$refs.timedBlockDialog.optionallyPrompt() + } else { + this.$store.dispatch('blockUser', this.user.id) + } } } } diff --git a/src/components/block_card/block_card.vue b/src/components/block_card/block_card.vue index b14ef8448..61aafb288 100644 --- a/src/components/block_card/block_card.vue +++ b/src/components/block_card/block_card.vue @@ -1,33 +1,32 @@ diff --git a/src/components/component_preview/component_preview.js b/src/components/component_preview/component_preview.js index c0a2aad72..9f830cd72 100644 --- a/src/components/component_preview/component_preview.js +++ b/src/components/component_preview/component_preview.js @@ -52,7 +52,7 @@ export default { this.$emit('update:shadow', { axis, value: Number(value) }) }, update () { - const sheet = createStyleSheet('style-component-preview') + const sheet = createStyleSheet('style-component-preview', 90) sheet.clear() diff --git a/src/components/confirm_modal/mute_confirm.js b/src/components/confirm_modal/mute_confirm.js index 1bef9f620..a279dc716 100644 --- a/src/components/confirm_modal/mute_confirm.js +++ b/src/components/confirm_modal/mute_confirm.js @@ -1,4 +1,3 @@ -import { unitToSeconds } from 'src/services/date_utils/date_utils.js' import { mapGetters } from 'vuex' import ConfirmModal from './confirm_modal.vue' @@ -8,21 +7,13 @@ export default { props: ['type', 'user', 'status'], emits: ['hide', 'show', 'muted'], data: () => ({ - showing: false, - muteExpiryAmount: 2, - muteExpiryUnit: 'hours' + showing: false }), components: { ConfirmModal, Select }, computed: { - muteExpiryValue () { - unitToSeconds(this.muteExpiryUnit, this.muteExpiryAmount) - }, - muteExpiryUnits () { - return ['minutes', 'hours', 'days'] - }, domain () { return this.user.fqn.split('@')[1] }, @@ -31,13 +22,8 @@ export default { return 'status.mute_domain_confirm' } else if (this.type === 'conversation') { return 'status.mute_conversation_confirm' - } else { - return 'user_card.mute_confirm' } }, - userIsMuted () { - return this.$store.getters.relationship(this.user.id).muting - }, conversationIsMuted () { return this.status.conversation_muted }, @@ -49,12 +35,9 @@ export default { case 'domain': { return this.mergedConfig.modalOnMuteDomain } - case 'conversation': { + default: { // conversation return this.mergedConfig.modalOnMuteConversation } - default: { - return this.mergedConfig.modalOnMute - } } }, ...mapGetters(['mergedConfig']) @@ -79,7 +62,7 @@ export default { switch (this.type) { case 'domain': { if (!this.domainIsMuted) { - this.$store.dispatch('muteDomain', { id: this.domain, expiresIn: this.muteExpiryValue }) + this.$store.dispatch('muteDomain', { id: this.domain }) } else { this.$store.dispatch('unmuteDomain', { id: this.domain }) } @@ -87,20 +70,12 @@ export default { } case 'conversation': { if (!this.conversationIsMuted) { - this.$store.dispatch('muteConversation', { id: this.status.id, expiresIn: this.muteExpiryValue }) + this.$store.dispatch('muteConversation', { id: this.status.id }) } else { this.$store.dispatch('unmuteConversation', { id: this.status.id }) } break } - default: { - if (!this.userIsMuted) { - this.$store.dispatch('muteUser', { id: this.user.id, expiresIn: this.muteExpiryValue }) - } else { - this.$store.dispatch('unmuteUser', { id: this.user.id }) - } - break - } } this.$emit('muted') this.hide() diff --git a/src/components/confirm_modal/mute_confirm.vue b/src/components/confirm_modal/mute_confirm.vue index bf7ab338f..7c754b006 100644 --- a/src/components/confirm_modal/mute_confirm.vue +++ b/src/components/confirm_modal/mute_confirm.vue @@ -18,36 +18,6 @@ -
-

- - - {{ ' ' }} - -

-
diff --git a/src/components/mute_card/mute_card.js b/src/components/mute_card/mute_card.js index cbec0e9bb..3d655465f 100644 --- a/src/components/mute_card/mute_card.js +++ b/src/components/mute_card/mute_card.js @@ -1,12 +1,8 @@ import BasicUserCard from '../basic_user_card/basic_user_card.vue' +import UserTimedFilterModal from 'src/components/user_timed_filter_modal/user_timed_filter_modal.vue' const MuteCard = { props: ['userId'], - data () { - return { - progress: false - } - }, computed: { user () { return this.$store.getters.findUser(this.userId) @@ -16,23 +12,24 @@ const MuteCard = { }, muted () { return this.relationship.muting + }, + muteExpiry () { + return this.user.mute_expires_at == null + ? this.$t('user_card.mute_expires_forever') + : this.$t('user_card.mute_expires_at', [new Date(this.user.mute_expires_at).toLocaleString()]) } }, components: { - BasicUserCard + BasicUserCard, + UserTimedFilterModal }, methods: { unmuteUser () { this.progress = true - this.$store.dispatch('unmuteUser', this.userId).then(() => { - this.progress = false - }) + this.$store.dispatch('unmuteUser', this.userId) }, muteUser () { - this.progress = true - this.$store.dispatch('muteUser', this.userId).then(() => { - this.progress = false - }) + this.$refs.timedMuteDialog.optionallyPrompt() } } } diff --git a/src/components/mute_card/mute_card.vue b/src/components/mute_card/mute_card.vue index 97e91cbca..08f62da9a 100644 --- a/src/components/mute_card/mute_card.vue +++ b/src/components/mute_card/mute_card.vue @@ -1,33 +1,32 @@ diff --git a/src/components/settings_modal/tabs/appearance_tab.js b/src/components/settings_modal/tabs/appearance_tab.js index e0f446a0e..838ac6d6c 100644 --- a/src/components/settings_modal/tabs/appearance_tab.js +++ b/src/components/settings_modal/tabs/appearance_tab.js @@ -412,11 +412,9 @@ const AppearanceTab = { } - const sheet = createStyleSheet('appearance-tab-previews') + const sheet = createStyleSheet('appearance-tab-previews', 90) sheet.addRule([ - '#theme-preview-', - key, - ' {\n', + '#theme-preview-', key, ' {\n', getCssRules(theme3.eager).join('\n'), '\n}' ].join('')) diff --git a/src/components/settings_modal/tabs/filtering_tab.js b/src/components/settings_modal/tabs/filtering_tab.js index 5ff137062..f78f6815c 100644 --- a/src/components/settings_modal/tabs/filtering_tab.js +++ b/src/components/settings_modal/tabs/filtering_tab.js @@ -107,7 +107,7 @@ const FilteringTab = { ...mapActions(useServerSideStorageStore, ['setPreference', 'unsetPreference', 'pushServerSideStorage']), getDatetimeLocal (timestamp) { const date = new Date(timestamp) - let fmt = new Intl.NumberFormat("en-US", {minimumIntegerDigits: 2}) + const fmt = new Intl.NumberFormat("en-US", {minimumIntegerDigits: 2}) const datetime = [ date.getFullYear(), '-', diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js index df28a23e3..7074a6d81 100644 --- a/src/components/settings_modal/tabs/general_tab.js +++ b/src/components/settings_modal/tabs/general_tab.js @@ -5,9 +5,12 @@ import IntegerSetting from '../helpers/integer_setting.vue' import FloatSetting from '../helpers/float_setting.vue' import UnitSetting from '../helpers/unit_setting.vue' import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue' +import Select from 'src/components/select/select.vue' import SharedComputedObject from '../helpers/shared_computed_object.js' import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue' + +import { mapState } from 'vuex' import { clearCache, cacheKey, emojiCacheKey } from 'src/services/sw/sw.js' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -56,6 +59,11 @@ const GeneralTab = { value: mode, label: this.$t(`settings.unsaved_post_action_${mode}`) })), + muteBlockLv1Options: ['ask', 'forever', 'temporarily'].map(mode => ({ + key: mode, + value: mode, + label: this.$t(`user_card.mute_block_${mode}`) + })), loopSilentAvailable: // Firefox Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') || @@ -73,12 +81,47 @@ const GeneralTab = { UnitSetting, InterfaceLanguageSwitcher, ScopeSelector, - ProfileSettingIndicator + ProfileSettingIndicator, + Select }, computed: { postFormats () { return this.$store.state.instance.postFormats || [] }, + onMuteDefaultActionLv1: { + get () { + const value = this.$store.state.config.onMuteDefaultAction + if (value === 'ask' || value === 'forever') { + return value + } else { + return 'temporarily' + } + }, + set (value) { + let realValue = value + if (value !== 'ask' && value !== 'forever') { + realValue = '14d' + } + this.$store.dispatch('setOption', { name: 'onMuteDefaultAction', value: realValue }) + } + }, + onBlockDefaultActionLv1: { + get () { + const value = this.$store.state.config.onBlockDefaultAction + if (value === 'ask' || value === 'forever') { + return value + } else { + return 'temporarily' + } + }, + set (value) { + let realValue = value + if (value !== 'ask' && value !== 'forever') { + realValue = '14d' + } + this.$store.dispatch('setOption', { name: 'onBlockDefaultAction', value: realValue }) + } + }, postContentOptions () { return this.postFormats.map(format => ({ key: format, @@ -94,7 +137,10 @@ const GeneralTab = { }, instanceShoutboxPresent () { return this.$store.state.instance.shoutAvailable }, instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel }, - ...SharedComputedObject() + ...SharedComputedObject(), + ...mapState({ + blockExpirationSupported: state => state.instance.blockExpiration + }) }, methods: { changeDefaultScope (value) { diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue index b8da782fb..648d7ac84 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -69,6 +69,66 @@ {{ $t('settings.user_popover_avatar_overlay') }} +
  • + {{ $t('user_card.default_mute_expiration') }} + + +
  • +
  • + {{ $t('user_card.default_block_expiration') }} + + +
  • - + {{ $t('settings.confirm_dialogs_block') }}
  • -
  • - - {{ $t('settings.confirm_dialogs_mute') }} - -
  • {{ $t('settings.confirm_dialogs_mute_conversation') }} diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.js b/src/components/settings_modal/tabs/style_tab/style_tab.js index f92579bb2..5453da57b 100644 --- a/src/components/settings_modal/tabs/style_tab/style_tab.js +++ b/src/components/settings_modal/tabs/style_tab/style_tab.js @@ -695,7 +695,7 @@ export default { return } - const sheet = createStyleSheet('style-tab-overall-preview') + const sheet = createStyleSheet('style-tab-overall-preview', 90) sheet.clear() sheet.addRule([ diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.js b/src/components/settings_modal/tabs/theme_tab/theme_tab.js index 70854e3bd..4b558471f 100644 --- a/src/components/settings_modal/tabs/theme_tab/theme_tab.js +++ b/src/components/settings_modal/tabs/theme_tab/theme_tab.js @@ -697,7 +697,7 @@ export default { liteMode: true }) - const sheet = createStyleSheet('theme-tab-overall-preview') + const sheet = createStyleSheet('theme-tab-overall-preview', 90) const rule = getScopedVersion( getCssRules(theme3.eager), '&' diff --git a/src/components/status_action_buttons/action_button_container.js b/src/components/status_action_buttons/action_button_container.js index 313e3022f..a8f20800b 100644 --- a/src/components/status_action_buttons/action_button_container.js +++ b/src/components/status_action_buttons/action_button_container.js @@ -1,6 +1,7 @@ import ActionButton from './action_button.vue' import Popover from 'src/components/popover/popover.vue' import MuteConfirm from 'src/components/confirm_modal/mute_confirm.vue' +import UserTimedFilterModal from 'src/components/user_timed_filter_modal/user_timed_filter_modal.vue' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -19,7 +20,8 @@ export default { components: { ActionButton, Popover, - MuteConfirm + MuteConfirm, + UserTimedFilterModal }, props: ['button', 'status'], emits: ['interacted'], diff --git a/src/components/status_action_buttons/action_button_container.vue b/src/components/status_action_buttons/action_button_container.vue index 931a40349..75f5010ee 100644 --- a/src/components/status_action_buttons/action_button_container.vue +++ b/src/components/status_action_buttons/action_button_container.vue @@ -94,11 +94,10 @@ :status="status" :user="user" /> - diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 55c76225c..0c01d5ff4 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -8,7 +8,8 @@ import UserNote from '../user_note/user_note.vue' import Select from '../select/select.vue' import UserLink from '../user_link/user_link.vue' import RichContent from 'src/components/rich_content/rich_content.jsx' -import MuteConfirm from '../confirm_modal/mute_confirm.vue' +import UserTimedFilterModal from 'src/components/user_timed_filter_modal/user_timed_filter_modal.vue' + import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' import { mapGetters } from 'vuex' import { usePostStatusStore } from 'src/stores/post_status' @@ -48,6 +49,19 @@ export default { 'onClose', 'hasNoteEditor' ], + components: { + UserAvatar, + RemoteFollow, + ModerationTools, + AccountActions, + ProgressButton, + FollowButton, + Select, + RichContent, + UserLink, + UserNote, + UserTimedFilterModal + }, data () { return { followRequestInProgress: false, @@ -145,24 +159,21 @@ export default { supportsNote () { return 'note' in this.relationship }, + muteExpiry () { + return this.user.mute_expires_at == null + ? this.$t('user_card.mute_expires_forever') + : this.$t('user_card.mute_expires_at', [new Date(this.user.mute_expires_at).toLocaleString()]) + }, + blockExpiry () { + return this.user.block_expires_at == null + ? this.$t('user_card.block_expires_forever') + : this.$t('user_card.block_expires_at', [new Date(this.user.mute_expires_at).toLocaleString()]) + }, ...mapGetters(['mergedConfig']) }, - components: { - UserAvatar, - RemoteFollow, - ModerationTools, - AccountActions, - ProgressButton, - FollowButton, - Select, - RichContent, - UserLink, - UserNote, - MuteConfirm - }, methods: { muteUser () { - this.$refs.confirmation.optionallyPrompt() + this.$refs.timedMuteDialog.optionallyPrompt() }, unmuteUser () { this.$store.dispatch('unmuteUser', this.user.id) diff --git a/src/components/user_card/user_card.scss b/src/components/user_card/user_card.scss index d263be1c0..418bef08b 100644 --- a/src/components/user_card/user_card.scss +++ b/src/components/user_card/user_card.scss @@ -8,6 +8,11 @@ --_still-image-label-visibility: hidden; } + .btn-mute, .btn-mention { + display: block; + width: 100%; + } + .panel-heading { padding: 0.5em 0; text-align: center; diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 36935424d..5e606d653 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -136,6 +136,18 @@ size="sm" /> + + {{ muteExpiry }} + + + {{ blockExpiry }} +