From 79d02bddbe2b77574844b8ade7a09043c31b1c6b Mon Sep 17 00:00:00 2001
From: marcin mikołajczak
Date: Sun, 13 Feb 2022 19:07:49 +0100
Subject: Birthdays
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: marcin mikołajczak
---
src/components/settings_modal/tabs/profile_tab.js | 6 +++++-
src/components/settings_modal/tabs/profile_tab.scss | 5 +++++
src/components/settings_modal/tabs/profile_tab.vue | 12 ++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
(limited to 'src/components/settings_modal/tabs')
diff --git a/src/components/settings_modal/tabs/profile_tab.js b/src/components/settings_modal/tabs/profile_tab.js
index 64079fcd..0ae95dbd 100644
--- a/src/components/settings_modal/tabs/profile_tab.js
+++ b/src/components/settings_modal/tabs/profile_tab.js
@@ -29,6 +29,8 @@ const ProfileTab = {
newLocked: this.$store.state.users.currentUser.locked,
newNoRichText: this.$store.state.users.currentUser.no_rich_text,
newDefaultScope: this.$store.state.users.currentUser.default_scope,
+ newBirthday: this.$store.state.users.currentUser.birthday,
+ showBirthday: this.$store.state.users.currentUser.show_birthday,
newFields: this.$store.state.users.currentUser.fields.map(field => ({ name: field.name, value: field.value })),
hideFollows: this.$store.state.users.currentUser.hide_follows,
hideFollowers: this.$store.state.users.currentUser.hide_followers,
@@ -132,7 +134,9 @@ const ProfileTab = {
allow_following_move: this.allowFollowingMove,
hide_follows_count: this.hideFollowsCount,
hide_followers_count: this.hideFollowersCount,
- show_role: this.showRole
+ show_role: this.showRole,
+ birthday: this.newBirthday || null,
+ show_birthday: this.showBirthday
/* eslint-enable camelcase */
} }).then((user) => {
this.newFields.splice(user.fields.length)
diff --git a/src/components/settings_modal/tabs/profile_tab.scss b/src/components/settings_modal/tabs/profile_tab.scss
index 111eaed3..24287511 100644
--- a/src/components/settings_modal/tabs/profile_tab.scss
+++ b/src/components/settings_modal/tabs/profile_tab.scss
@@ -124,4 +124,9 @@
padding: 0 0.5em;
}
}
+
+ .birthday-input {
+ display: block;
+ margin-bottom: 1em;
+ }
}
diff --git a/src/components/settings_modal/tabs/profile_tab.vue b/src/components/settings_modal/tabs/profile_tab.vue
index bb3c301d..9b92056d 100644
--- a/src/components/settings_modal/tabs/profile_tab.vue
+++ b/src/components/settings_modal/tabs/profile_tab.vue
@@ -95,6 +95,18 @@
{{ $t('settings.discoverable') }}
+
Date: Sat, 21 Jan 2023 01:28:43 -0500
Subject: Make all emoji inputs screen-reader-friendly
---
src/components/emoji_input/emoji_input.js | 1 +
.../post_status_form/post_status_form.js | 4 ++
.../post_status_form/post_status_form.vue | 25 ++++++------
src/components/settings_modal/tabs/profile_tab.js | 4 ++
src/components/settings_modal/tabs/profile_tab.vue | 46 ++++++++++++++--------
.../attributes_helper/attributes_helper.service.js | 8 ++++
6 files changed, 58 insertions(+), 30 deletions(-)
create mode 100644 src/services/attributes_helper/attributes_helper.service.js
(limited to 'src/components/settings_modal/tabs')
diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js
index 020e9fde..3b0db786 100644
--- a/src/components/emoji_input/emoji_input.js
+++ b/src/components/emoji_input/emoji_input.js
@@ -287,6 +287,7 @@ const EmojiInput = {
...rest,
img: imageUrl || ''
}))
+ this.highlighted = -1
this.$refs.screenReaderNotice.announce(
this.$tc('tool_tip.autocomplete_available',
this.suggestions.length,
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index eb55cfcc..b75fee69 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -8,6 +8,7 @@ import Gallery from 'src/components/gallery/gallery.vue'
import StatusContent from '../status_content/status_content.vue'
import fileTypeService from '../../services/file_type/file_type.service.js'
import { findOffset } from '../../services/offset_finder/offset_finder.service.js'
+import { propsToNative } from '../../services/attributes_helper/attributes_helper.service.js'
import { reject, map, uniqBy, debounce } from 'lodash'
import suggestor from '../emoji_input/suggestor.js'
import { mapGetters, mapState } from 'vuex'
@@ -629,6 +630,9 @@ const PostStatusForm = {
},
openProfileTab () {
this.$store.dispatch('openSettingsModalTab', 'profile')
+ },
+ propsToNative (props) {
+ return propsToNative(props)
}
}
}
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 26a5acc4..328e145f 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -124,14 +124,17 @@
:suggest="emojiSuggestor"
class="form-control"
>
-
+
+
+
-
+
+
+
{{ $t('settings.bio') }}
-
+
+
+
@@ -48,10 +54,13 @@
hide-emoji-button
:suggest="userSuggestor"
>
-
+
+
+
-
+
+
+
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
index 9de3ed81..703e94a0 100644
--- a/src/components/settings_modal/tabs/general_tab.vue
+++ b/src/components/settings_modal/tabs/general_tab.vue
@@ -191,6 +191,11 @@
{{ $t('settings.confirm_dialogs_deny_follow') }}
+
+
+ {{ $t('settings.confirm_dialogs_remove_follower') }}
+
+
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 213f9cf0..ca022c82 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -429,6 +429,7 @@
"confirm_dialogs_logout": "logging out",
"confirm_dialogs_approve_follow": "approving a follower",
"confirm_dialogs_deny_follow": "denying a follower",
+ "confirm_dialogs_remove_follower": "removing a follower",
"mutes_and_blocks": "Mutes and Blocks",
"data_import_export_tab": "Data import / export",
"default_vis": "Default visibility scope",
@@ -964,6 +965,10 @@
"per_day": "per day",
"remote_follow": "Remote follow",
"remove_follower": "Remove follower",
+ "remove_follower_confirm_title": "Remove follower confirmation",
+ "remove_follower_confirm_accept_button": "Remove",
+ "remove_follower_confirm_cancel_button": "Keep",
+ "remove_follower_confirm": "Do you really want to remove {user} from your followers?",
"report": "Report",
"statuses": "Statuses",
"subscribe": "Subscribe",
diff --git a/src/modules/config.js b/src/modules/config.js
index 1df279a2..8e6b2c3d 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -86,6 +86,7 @@ export const defaultState = {
modalOnLogout: undefined, // instance default
modalOnApproveFollow: undefined, // instance default
modalOnDenyFollow: undefined, // instance default
+ modalOnRemoveUserFromFollowers: undefined, // instance default
playVideosInModal: false,
useOneClickNsfw: false,
useContainFit: true,
diff --git a/src/modules/instance.js b/src/modules/instance.js
index fcb6eecc..ce958907 100644
--- a/src/modules/instance.js
+++ b/src/modules/instance.js
@@ -79,6 +79,7 @@ const defaultState = {
modalOnLogout: true,
modalOnApproveFollow: false,
modalOnDenyFollow: false,
+ modalOnRemoveUserFromFollowers: false,
loginMethod: 'password',
logo: '/static/logo.svg',
logoMargin: '.2em',
--
cgit v1.2.3-70-g09d2
From 5468309f6aefbc61467338d2a96f29d6c416cc54 Mon Sep 17 00:00:00 2001
From: tusooa
Date: Mon, 20 Feb 2023 23:49:34 -0500
Subject: Make it possible to auto-select the first candidate in autocomplete
---
src/components/emoji_input/emoji_input.js | 5 ++++-
src/components/settings_modal/tabs/general_tab.vue | 8 ++++++++
src/i18n/en.json | 1 +
src/modules/config.js | 3 ++-
src/modules/instance.js | 1 +
5 files changed, 16 insertions(+), 2 deletions(-)
(limited to 'src/components/settings_modal/tabs')
diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js
index 8a8d098d..68654f69 100644
--- a/src/components/emoji_input/emoji_input.js
+++ b/src/components/emoji_input/emoji_input.js
@@ -134,6 +134,9 @@ const EmojiInput = {
padEmoji () {
return this.$store.getters.mergedConfig.padEmoji
},
+ defaultCandidateIndex () {
+ return this.$store.getters.mergedConfig.autocompleteSelect ? 0 : -1
+ },
preText () {
return this.modelValue.slice(0, this.caret)
},
@@ -287,7 +290,7 @@ const EmojiInput = {
...rest,
img: imageUrl || ''
}))
- this.highlighted = -1
+ this.highlighted = this.defaultCandidateIndex
this.$refs.screenReaderNotice.announce(
this.$tc('tool_tip.autocomplete_available',
this.suggestions.length,
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
index 703e94a0..65248ac1 100644
--- a/src/components/settings_modal/tabs/general_tab.vue
+++ b/src/components/settings_modal/tabs/general_tab.vue
@@ -501,6 +501,14 @@
{{ $t('settings.pad_emoji') }}
+
+
+ {{ $t('settings.autocomplete_select_first') }}
+
+
diff --git a/src/i18n/en.json b/src/i18n/en.json
index dba8a13f..6c9bc8e2 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -465,6 +465,7 @@
"domain_mutes": "Domains",
"avatar_size_instruction": "The recommended minimum size for avatar images is 150x150 pixels.",
"pad_emoji": "Pad emoji with spaces when adding from picker",
+ "autocomplete_select_first": "Automatically select the first candidate when autocomplete results are available",
"emoji_reactions_on_timeline": "Show emoji reactions on timeline",
"export_theme": "Save preset",
"filtering": "Filtering",
diff --git a/src/modules/config.js b/src/modules/config.js
index eb33f95f..3d9cf591 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -115,7 +115,8 @@ export const defaultState = {
conversationTreeAdvanced: undefined, // instance default
conversationOtherRepliesButton: undefined, // instance default
conversationTreeFadeAncestors: undefined, // instance default
- maxDepthInThread: undefined // instance default
+ maxDepthInThread: undefined, // instance default
+ autocompleteSelect: undefined // instance default
}
// caching the instance default properties
diff --git a/src/modules/instance.js b/src/modules/instance.js
index 16f72583..938ca64d 100644
--- a/src/modules/instance.js
+++ b/src/modules/instance.js
@@ -104,6 +104,7 @@ const defaultState = {
conversationOtherRepliesButton: 'below',
conversationTreeFadeAncestors: false,
maxDepthInThread: 6,
+ autocompleteSelect: false,
// Nasty stuff
customEmoji: [],
--
cgit v1.2.3-70-g09d2
From e516eee479cf6e943b6fc43d0a9d18793c141ba0 Mon Sep 17 00:00:00 2001
From: tusooa
Date: Tue, 21 Feb 2023 00:39:16 -0500
Subject: Make block & mute lists able to load more
---
src/components/list/list.vue | 6 +++-
.../settings_modal/tabs/mutes_and_blocks_tab.js | 7 ++--
src/hocs/with_load_more/with_load_more.jsx | 2 +-
src/modules/users.js | 38 ++++++++++++++++++----
src/services/api/api.service.js | 16 ++++++---
5 files changed, 55 insertions(+), 14 deletions(-)
(limited to 'src/components/settings_modal/tabs')
diff --git a/src/components/list/list.vue b/src/components/list/list.vue
index f17766b4..a3562c5d 100644
--- a/src/components/list/list.vue
+++ b/src/components/list/list.vue
@@ -1,9 +1,13 @@
-
+
$store.dispatch('fetchBlocks'),
select: (props, $store) => get($store.state.users.currentUser, 'blockIds', []),
+ destroy: () => {},
childPropName: 'items'
})(SelectableList)
-const MuteList = withSubscription({
+const MuteList = withLoadMore({
fetch: (props, $store) => $store.dispatch('fetchMutes'),
select: (props, $store) => get($store.state.users.currentUser, 'muteIds', []),
+ destroy: () => {},
childPropName: 'items'
})(SelectableList)
diff --git a/src/hocs/with_load_more/with_load_more.jsx b/src/hocs/with_load_more/with_load_more.jsx
index c0ae1856..4e5bb50f 100644
--- a/src/hocs/with_load_more/with_load_more.jsx
+++ b/src/hocs/with_load_more/with_load_more.jsx
@@ -98,7 +98,7 @@ const withLoadMore = ({
}
{!this.error && this.loading && }
- {!this.error && !this.loading && !this.bottomedOut && {this.$t('general.more')}}
+ {!this.error && !this.loading && !this.bottomedOut && {this.$t('general.more')}}
)
diff --git a/src/modules/users.js b/src/modules/users.js
index a1316ba2..7b41fab6 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -195,9 +195,15 @@ export const mutations = {
state.currentUser.blockIds.push(blockId)
}
},
+ setBlockIdsMaxId (state, blockIdsMaxId) {
+ state.currentUser.blockIdsMaxId = blockIdsMaxId
+ },
saveMuteIds (state, muteIds) {
state.currentUser.muteIds = muteIds
},
+ setMuteIdsMaxId (state, muteIdsMaxId) {
+ state.currentUser.muteIdsMaxId = muteIdsMaxId
+ },
addMuteId (state, muteId) {
if (state.currentUser.muteIds.indexOf(muteId) === -1) {
state.currentUser.muteIds.push(muteId)
@@ -320,10 +326,20 @@ const users = {
.then((inLists) => store.commit('updateUserInLists', { id, inLists }))
}
},
- fetchBlocks (store) {
- return store.rootState.api.backendInteractor.fetchBlocks()
+ fetchBlocks (store, args) {
+ const { reset } = args || {}
+
+ const maxId = store.state.currentUser.blockIdsMaxId
+ return store.rootState.api.backendInteractor.fetchBlocks({ maxId })
.then((blocks) => {
- store.commit('saveBlockIds', map(blocks, 'id'))
+ if (reset) {
+ store.commit('saveBlockIds', map(blocks, 'id'))
+ } else {
+ map(blocks, 'id').map(id => store.commit('addBlockId', id))
+ }
+ if (blocks.length) {
+ store.commit('setBlockIdsMaxId', last(blocks).id)
+ }
store.commit('addNewUsers', blocks)
return blocks
})
@@ -346,10 +362,20 @@ const users = {
editUserNote (store, args) {
return editUserNote(store, args)
},
- fetchMutes (store) {
- return store.rootState.api.backendInteractor.fetchMutes()
+ fetchMutes (store, args) {
+ const { reset } = args || {}
+
+ const maxId = store.state.currentUser.muteIdsMaxId
+ return store.rootState.api.backendInteractor.fetchMutes({ maxId })
.then((mutes) => {
- store.commit('saveMuteIds', map(mutes, 'id'))
+ if (reset) {
+ store.commit('saveMuteIds', map(mutes, 'id'))
+ } else {
+ map(mutes, 'id').map(id => store.commit('addMuteId', id))
+ }
+ if (mutes.length) {
+ store.commit('setMuteIdsMaxId', last(mutes).id)
+ }
store.commit('addNewUsers', mutes)
return mutes
})
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index b8c10b21..94bb0c54 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -1113,8 +1113,12 @@ const generateMfaBackupCodes = ({ credentials }) => {
}).then((data) => data.json())
}
-const fetchMutes = ({ credentials }) => {
- return promisedRequest({ url: MASTODON_USER_MUTES_URL, credentials })
+const fetchMutes = ({ maxId, credentials }) => {
+ const query = new URLSearchParams({ with_relationships: true })
+ if (maxId) {
+ query.append('max_id', maxId)
+ }
+ return promisedRequest({ url: `${MASTODON_USER_MUTES_URL}?${query.toString()}`, credentials })
.then((users) => users.map(parseUser))
}
@@ -1138,8 +1142,12 @@ const unsubscribeUser = ({ id, credentials }) => {
return promisedRequest({ url: MASTODON_UNSUBSCRIBE_USER(id), credentials, method: 'POST' })
}
-const fetchBlocks = ({ credentials }) => {
- return promisedRequest({ url: MASTODON_USER_BLOCKS_URL, credentials })
+const fetchBlocks = ({ maxId, credentials }) => {
+ const query = new URLSearchParams({ with_relationships: true })
+ if (maxId) {
+ query.append('max_id', maxId)
+ }
+ return promisedRequest({ url: `${MASTODON_USER_BLOCKS_URL}?${query.toString()}`, credentials })
.then((users) => users.map(parseUser))
}
--
cgit v1.2.3-70-g09d2
From af0cd5422304d7b2111739d85c279b3fa175a853 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Sun, 12 Mar 2023 14:32:13 +0200
Subject: serverSideConfig renamed into profileSettingConfig to avoid confusion
with serverSideStorage, reduced overall need for SharedComputedObject in
settings tabs, moved copypaste code of "setting" type of helpers into a
separate file.
---
.../settings_modal/helpers/boolean_setting.js | 53 +-------
.../settings_modal/helpers/boolean_setting.vue | 4 +-
.../settings_modal/helpers/choice_setting.js | 51 ++------
.../settings_modal/helpers/choice_setting.vue | 2 +-
.../settings_modal/helpers/integer_setting.js | 39 +-----
.../helpers/profile_setting_indicator.vue | 51 ++++++++
.../helpers/server_side_indicator.vue | 51 --------
src/components/settings_modal/helpers/setting.js | 84 +++++++++++++
.../helpers/shared_computed_object.js | 18 ---
.../settings_modal/helpers/size_setting.js | 48 ++-----
.../settings_modal/tabs/filtering_tab.vue | 14 +--
src/components/settings_modal/tabs/general_tab.js | 6 +-
src/components/settings_modal/tabs/general_tab.vue | 29 ++---
.../settings_modal/tabs/notifications_tab.vue | 4 +-
src/components/settings_modal/tabs/profile_tab.vue | 32 +++--
src/main.js | 4 +-
src/modules/config.js | 3 +-
src/modules/profileConfig.js | 140 +++++++++++++++++++++
src/modules/serverSideConfig.js | 140 ---------------------
19 files changed, 351 insertions(+), 422 deletions(-)
create mode 100644 src/components/settings_modal/helpers/profile_setting_indicator.vue
delete mode 100644 src/components/settings_modal/helpers/server_side_indicator.vue
create mode 100644 src/components/settings_modal/helpers/setting.js
create mode 100644 src/modules/profileConfig.js
delete mode 100644 src/modules/serverSideConfig.js
(limited to 'src/components/settings_modal/tabs')
diff --git a/src/components/settings_modal/helpers/boolean_setting.js b/src/components/settings_modal/helpers/boolean_setting.js
index 2e6992cb..078cc5ff 100644
--- a/src/components/settings_modal/helpers/boolean_setting.js
+++ b/src/components/settings_modal/helpers/boolean_setting.js
@@ -1,56 +1,13 @@
-import { get, set } from 'lodash'
import Checkbox from 'src/components/checkbox/checkbox.vue'
import ModifiedIndicator from './modified_indicator.vue'
-import ServerSideIndicator from './server_side_indicator.vue'
+import ProfileSettingIndicator from './profile_setting_indicator.vue'
+import Setting from './setting.js'
+
export default {
components: {
Checkbox,
ModifiedIndicator,
- ServerSideIndicator
+ ProfileSettingIndicator
},
- props: [
- 'path',
- 'disabled',
- 'expert'
- ],
- computed: {
- pathDefault () {
- const [firstSegment, ...rest] = this.path.split('.')
- return [firstSegment + 'DefaultValue', ...rest].join('.')
- },
- state () {
- const value = get(this.$parent, this.path)
- if (value === undefined) {
- return this.defaultState
- } else {
- return value
- }
- },
- defaultState () {
- return get(this.$parent, this.pathDefault)
- },
- isServerSide () {
- return this.path.startsWith('serverSide_')
- },
- isChanged () {
- return !this.path.startsWith('serverSide_') && this.state !== this.defaultState
- },
- matchesExpertLevel () {
- return (this.expert || 0) <= this.$parent.expertLevel
- }
- },
- methods: {
- update (e) {
- const [firstSegment, ...rest] = this.path.split('.')
- set(this.$parent, this.path, e)
- // Updating nested properties does not trigger update on its parent.
- // probably still not as reliable, but works for depth=1 at least
- if (rest.length > 0) {
- set(this.$parent, firstSegment, { ...get(this.$parent, firstSegment) })
- }
- },
- reset () {
- set(this.$parent, this.path, this.defaultState)
- }
- }
+ ...Setting
}
diff --git a/src/components/settings_modal/helpers/boolean_setting.vue b/src/components/settings_modal/helpers/boolean_setting.vue
index 41142966..bc014bc9 100644
--- a/src/components/settings_modal/helpers/boolean_setting.vue
+++ b/src/components/settings_modal/helpers/boolean_setting.vue
@@ -5,7 +5,7 @@
>
-
+
diff --git a/src/components/settings_modal/helpers/choice_setting.js b/src/components/settings_modal/helpers/choice_setting.js
index 3da559fe..8aa5f54b 100644
--- a/src/components/settings_modal/helpers/choice_setting.js
+++ b/src/components/settings_modal/helpers/choice_setting.js
@@ -1,51 +1,20 @@
-import { get, set } from 'lodash'
import Select from 'src/components/select/select.vue'
import ModifiedIndicator from './modified_indicator.vue'
-import ServerSideIndicator from './server_side_indicator.vue'
+import ProfileSettingIndicator from './profile_setting_indicator.vue'
+import Setting from './setting.js'
+
export default {
components: {
Select,
ModifiedIndicator,
- ServerSideIndicator
+ ProfileSettingIndicator
},
- props: [
- 'path',
- 'disabled',
- 'options',
- 'expert'
- ],
- computed: {
- pathDefault () {
- const [firstSegment, ...rest] = this.path.split('.')
- return [firstSegment + 'DefaultValue', ...rest].join('.')
- },
- state () {
- const value = get(this.$parent, this.path)
- if (value === undefined) {
- return this.defaultState
- } else {
- return value
- }
- },
- defaultState () {
- return get(this.$parent, this.pathDefault)
- },
- isServerSide () {
- return this.path.startsWith('serverSide_')
- },
- isChanged () {
- return !this.path.startsWith('serverSide_') && this.state !== this.defaultState
- },
- matchesExpertLevel () {
- return (this.expert || 0) <= this.$parent.expertLevel
- }
- },
- methods: {
- update (e) {
- set(this.$parent, this.path, e)
- },
- reset () {
- set(this.$parent, this.path, this.defaultState)
+ ...Setting,
+ props: {
+ ...Setting.props,
+ options: {
+ type: Array,
+ required: true
}
}
}
diff --git a/src/components/settings_modal/helpers/choice_setting.vue b/src/components/settings_modal/helpers/choice_setting.vue
index 8fdbb5d3..4c4cdefe 100644
--- a/src/components/settings_modal/helpers/choice_setting.vue
+++ b/src/components/settings_modal/helpers/choice_setting.vue
@@ -23,7 +23,7 @@
:changed="isChanged"
:onclick="reset"
/>
-
+
diff --git a/src/components/settings_modal/helpers/integer_setting.js b/src/components/settings_modal/helpers/integer_setting.js
index e64d0cee..0f29f11a 100644
--- a/src/components/settings_modal/helpers/integer_setting.js
+++ b/src/components/settings_modal/helpers/integer_setting.js
@@ -1,44 +1,15 @@
-import { get, set } from 'lodash'
import ModifiedIndicator from './modified_indicator.vue'
+import Setting from './setting.js'
+
export default {
components: {
ModifiedIndicator
},
- props: {
- path: String,
- disabled: Boolean,
- min: Number,
- expert: [Number, String]
- },
- computed: {
- pathDefault () {
- const [firstSegment, ...rest] = this.path.split('.')
- return [firstSegment + 'DefaultValue', ...rest].join('.')
- },
- state () {
- const value = get(this.$parent, this.path)
- if (value === undefined) {
- return this.defaultState
- } else {
- return value
- }
- },
- defaultState () {
- return get(this.$parent, this.pathDefault)
- },
- isChanged () {
- return this.state !== this.defaultState
- },
- matchesExpertLevel () {
- return (this.expert || 0) <= this.$parent.expertLevel
- }
- },
+ ...Setting,
methods: {
+ ...Setting.methods,
update (e) {
- set(this.$parent, this.path, parseInt(e.target.value))
- },
- reset () {
- set(this.$parent, this.path, this.defaultState)
+ this.configSink(this.path, parseInt(e.target.value))
}
}
}
diff --git a/src/components/settings_modal/helpers/profile_setting_indicator.vue b/src/components/settings_modal/helpers/profile_setting_indicator.vue
new file mode 100644
index 00000000..d160781b
--- /dev/null
+++ b/src/components/settings_modal/helpers/profile_setting_indicator.vue
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+ {{ $t('settings.setting_server_side') }}
+
+
+
+
+
+
+
+
+
diff --git a/src/components/settings_modal/helpers/server_side_indicator.vue b/src/components/settings_modal/helpers/server_side_indicator.vue
deleted file mode 100644
index bf181959..00000000
--- a/src/components/settings_modal/helpers/server_side_indicator.vue
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
- {{ $t('settings.setting_server_side') }}
-
-
-
-
-
-
-
-
-
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
new file mode 100644
index 00000000..dc37675c
--- /dev/null
+++ b/src/components/settings_modal/helpers/setting.js
@@ -0,0 +1,84 @@
+import { get, set } from 'lodash'
+export default {
+ props: {
+ path: {
+ type: String,
+ required: true
+ },
+ disabled: {
+ type: Boolean,
+ default: false
+ },
+ parentPath: {
+ type: String
+ },
+ parentInvert: {
+ type: Boolean,
+ default: false
+ },
+ expert: {
+ type: [Number, String],
+ default: 0
+ },
+ source: {
+ type: String,
+ default: 'default'
+ }
+ },
+ computed: {
+ state () {
+ const value = get(this.configSource, this.path)
+ if (value === undefined) {
+ return this.defaultState
+ } else {
+ return value
+ }
+ },
+ shouldBeDisabled () {
+ const parentValue = this.parentPath !== undefined ? get(this.configSource, this.parentPath) : null
+ return this.disabled || (parentValue !== null ? (this.parentInvert ? parentValue : !parentValue) : false)
+ },
+ configSource () {
+ switch (this.source) {
+ case 'profile':
+ return this.$store.state.profileConfig
+ default:
+ return this.$store.getters.mergedConfig
+ }
+ },
+ configSink () {
+ switch (this.source) {
+ case 'profile':
+ return (k, v) => this.$store.dispatch('setProfileOption', { name: k, value: v })
+ default:
+ return (k, v) => this.$store.dispatch('setOption', { name: k, value: v })
+ }
+ },
+ defaultState () {
+ switch (this.source) {
+ case 'profile':
+ return {}
+ default:
+ return get(this.$store.getters.defaultConfig, this.path)
+ }
+ },
+ isProfileTied () {
+ return this.source === 'profile'
+ },
+ isChanged () {
+ return !this.source === 'default' && this.state !== this.defaultState
+ },
+ matchesExpertLevel () {
+ return (this.expert || 0) <= this.$store.state.config.expertLevel > 0
+ }
+ },
+ methods: {
+ update (e) {
+ console.log('U', this.path, e)
+ this.configSink(this.path, e)
+ },
+ reset () {
+ set(this.$store.getters.mergedConfig, this.path, this.defaultState)
+ }
+ }
+}
diff --git a/src/components/settings_modal/helpers/shared_computed_object.js b/src/components/settings_modal/helpers/shared_computed_object.js
index 12431dca..6b22174d 100644
--- a/src/components/settings_modal/helpers/shared_computed_object.js
+++ b/src/components/settings_modal/helpers/shared_computed_object.js
@@ -1,19 +1,9 @@
import { defaultState as configDefaultState } from 'src/modules/config.js'
-import { defaultState as serverSideConfigDefaultState } from 'src/modules/serverSideConfig.js'
const SharedComputedObject = () => ({
user () {
return this.$store.state.users.currentUser
},
- // Getting values for default properties
- ...Object.keys(configDefaultState)
- .map(key => [
- key + 'DefaultValue',
- function () {
- return this.$store.getters.defaultConfig[key]
- }
- ])
- .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}),
// Generating computed values for vuex properties
...Object.keys(configDefaultState)
.map(key => [key, {
@@ -23,14 +13,6 @@ const SharedComputedObject = () => ({
}
}])
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}),
- ...Object.keys(serverSideConfigDefaultState)
- .map(key => ['serverSide_' + key, {
- get () { return this.$store.state.serverSideConfig[key] },
- set (value) {
- this.$store.dispatch('setServerSideOption', { name: key, value })
- }
- }])
- .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}),
// Special cases (need to transform values or perform actions first)
useStreamingApi: {
get () { return this.$store.getters.mergedConfig.useStreamingApi },
diff --git a/src/components/settings_modal/helpers/size_setting.js b/src/components/settings_modal/helpers/size_setting.js
index 58697412..4a0f7e48 100644
--- a/src/components/settings_modal/helpers/size_setting.js
+++ b/src/components/settings_modal/helpers/size_setting.js
@@ -1,6 +1,6 @@
-import { get, set } from 'lodash'
import ModifiedIndicator from './modified_indicator.vue'
import Select from 'src/components/select/select.vue'
+import Setting from './setting.js'
export const allCssUnits = ['cm', 'mm', 'in', 'px', 'pt', 'pc', 'em', 'ex', 'ch', 'rem', 'vw', 'vh', 'vmin', 'vmax', '%']
export const defaultHorizontalUnits = ['px', 'rem', 'vw']
@@ -11,57 +11,31 @@ export default {
ModifiedIndicator,
Select
},
+ ...Setting,
props: {
- path: String,
- disabled: Boolean,
+ ...Setting.props,
min: Number,
units: {
- type: [String],
+ type: Array,
default: () => allCssUnits
- },
- expert: [Number, String]
+ }
},
computed: {
- pathDefault () {
- const [firstSegment, ...rest] = this.path.split('.')
- return [firstSegment + 'DefaultValue', ...rest].join('.')
- },
+ ...Setting.computed,
stateUnit () {
- return (this.state || '').replace(/\d+/, '')
+ return this.state.replace(/\d+/, '')
},
stateValue () {
- return (this.state || '').replace(/\D+/, '')
- },
- state () {
- const value = get(this.$parent, this.path)
- if (value === undefined) {
- return this.defaultState
- } else {
- return value
- }
- },
- defaultState () {
- return get(this.$parent, this.pathDefault)
- },
- isChanged () {
- return this.state !== this.defaultState
- },
- matchesExpertLevel () {
- return (this.expert || 0) <= this.$parent.expertLevel
+ return this.state.replace(/\D+/, '')
}
},
methods: {
- update (e) {
- set(this.$parent, this.path, e)
- },
- reset () {
- set(this.$parent, this.path, this.defaultState)
- },
+ ...Setting.methods,
updateValue (e) {
- set(this.$parent, this.path, parseInt(e.target.value) + this.stateUnit)
+ this.configSink(this.path, parseInt(e.target.value) + this.stateUnit)
},
updateUnit (e) {
- set(this.$parent, this.path, this.stateValue + e.target.value)
+ this.configSink(this.path, this.stateValue + e.target.value)
}
}
}
diff --git a/src/components/settings_modal/tabs/filtering_tab.vue b/src/components/settings_modal/tabs/filtering_tab.vue
index 97046ff0..46c6bc5c 100644
--- a/src/components/settings_modal/tabs/filtering_tab.vue
+++ b/src/components/settings_modal/tabs/filtering_tab.vue
@@ -7,13 +7,11 @@
{{ $t('settings.hide_filtered_statuses') }}
-
+
-
{{ $t('settings.hide_wordfiltered_statuses') }}
@@ -22,7 +20,8 @@
-
{{ $t('settings.hide_muted_threads') }}
@@ -31,7 +30,8 @@
-
{{ $t('settings.hide_muted_posts') }}
diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js
index ea24d6ad..e8f7016e 100644
--- a/src/components/settings_modal/tabs/general_tab.js
+++ b/src/components/settings_modal/tabs/general_tab.js
@@ -6,7 +6,7 @@ import SizeSetting, { defaultHorizontalUnits } from '../helpers/size_setting.vue
import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js'
-import ServerSideIndicator from '../helpers/server_side_indicator.vue'
+import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faGlobe
@@ -65,7 +65,7 @@ const GeneralTab = {
SizeSetting,
InterfaceLanguageSwitcher,
ScopeSelector,
- ServerSideIndicator
+ ProfileSettingIndicator
},
computed: {
horizontalUnits () {
@@ -108,7 +108,7 @@ const GeneralTab = {
},
methods: {
changeDefaultScope (value) {
- this.$store.dispatch('setServerSideOption', { name: 'defaultScope', value })
+ this.$store.dispatch('setProfileOption', { name: 'defaultScope', value })
}
}
}
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
index 65248ac1..0eb3d06c 100644
--- a/src/components/settings_modal/tabs/general_tab.vue
+++ b/src/components/settings_modal/tabs/general_tab.vue
@@ -29,14 +29,11 @@
{{ $t('settings.streaming') }}
-
+
-
{{ $t('settings.pause_on_unfocused') }}
@@ -265,7 +262,7 @@
-
{{ $t('settings.no_rich_text_description') }}
@@ -290,7 +287,7 @@
{{ $t('settings.preload_images') }}
@@ -299,7 +296,7 @@
{{ $t('settings.use_one_click_nsfw') }}
@@ -312,15 +309,13 @@
>
{{ $t('settings.loop_video') }}
-
+
-
{{ $t('settings.loop_video_silent_only') }}
@@ -418,18 +413,18 @@
-
-
-
+
{{ $t('settings.sensitive_by_default') }}
diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue
index dd3806ed..ea095372 100644
--- a/src/components/settings_modal/tabs/notifications_tab.vue
+++ b/src/components/settings_modal/tabs/notifications_tab.vue
@@ -4,7 +4,7 @@
{{ $t('settings.notification_setting_filters') }}
-
-
+
{{ $t('settings.notification_setting_block_from_strangers') }}
@@ -67,7 +67,7 @@
-
{{ $t('settings.notification_setting_hide_notification_contents') }}
diff --git a/src/components/settings_modal/tabs/profile_tab.vue b/src/components/settings_modal/tabs/profile_tab.vue
index 6a5b478a..74652990 100644
--- a/src/components/settings_modal/tabs/profile_tab.vue
+++ b/src/components/settings_modal/tabs/profile_tab.vue
@@ -254,37 +254,35 @@
{{ $t('settings.account_privacy') }}
-
-
+
{{ $t('settings.lock_account_description') }}
-
-
+
{{ $t('settings.discoverable') }}
-
-
+
{{ $t('settings.allow_following_move') }}
-
-
+
{{ $t('settings.hide_favorites_description') }}
-
-
+
{{ $t('settings.hide_followers_description') }}
-
+
-
{{ $t('settings.hide_followers_count_description') }}
@@ -292,17 +290,15 @@
-
-
+
{{ $t('settings.hide_follows_description') }}
-
+
-
{{ $t('settings.hide_follows_count_description') }}
diff --git a/src/main.js b/src/main.js
index d3e60a0f..fd712113 100644
--- a/src/main.js
+++ b/src/main.js
@@ -10,7 +10,7 @@ import listsModule from './modules/lists.js'
import usersModule from './modules/users.js'
import apiModule from './modules/api.js'
import configModule from './modules/config.js'
-import serverSideConfigModule from './modules/serverSideConfig.js'
+import profileConfigModule from './modules/profileConfig.js'
import serverSideStorageModule from './modules/serverSideStorage.js'
import shoutModule from './modules/shout.js'
import oauthModule from './modules/oauth.js'
@@ -80,7 +80,7 @@ const persistedStateOptions = {
lists: listsModule,
api: apiModule,
config: configModule,
- serverSideConfig: serverSideConfigModule,
+ profileConfig: profileConfigModule,
serverSideStorage: serverSideStorageModule,
shout: shoutModule,
oauth: oauthModule,
diff --git a/src/modules/config.js b/src/modules/config.js
index 3d9cf591..6ab59d6d 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -1,6 +1,7 @@
import Cookies from 'js-cookie'
import { setPreset, applyTheme, applyConfig } from '../services/style_setter/style_setter.js'
import messages from '../i18n/messages'
+import { set } from 'lodash'
import localeService from '../services/locale/locale.service.js'
const BACKEND_LANGUAGE_COOKIE_NAME = 'userLanguage'
@@ -147,7 +148,7 @@ const config = {
},
mutations: {
setOption (state, { name, value }) {
- state[name] = value
+ set(state, name, value)
},
setHighlight (state, { user, color, type }) {
const data = this.state.config.highlight[user]
diff --git a/src/modules/profileConfig.js b/src/modules/profileConfig.js
new file mode 100644
index 00000000..2cb2014a
--- /dev/null
+++ b/src/modules/profileConfig.js
@@ -0,0 +1,140 @@
+import { get, set } from 'lodash'
+
+const defaultApi = ({ rootState, commit }, { path, value }) => {
+ const params = {}
+ set(params, path, value)
+ return rootState
+ .api
+ .backendInteractor
+ .updateProfile({ params })
+ .then(result => {
+ commit('addNewUsers', [result])
+ commit('setCurrentUser', result)
+ })
+}
+
+const notificationsApi = ({ rootState, commit }, { path, value, oldValue }) => {
+ const settings = {}
+ set(settings, path, value)
+ return rootState
+ .api
+ .backendInteractor
+ .updateNotificationSettings({ settings })
+ .then(result => {
+ if (result.status === 'success') {
+ commit('confirmProfileOption', { name, value })
+ } else {
+ commit('confirmProfileOption', { name, value: oldValue })
+ }
+ })
+}
+
+/**
+ * Map that stores relation between path for reading (from user profile),
+ * for writing (into API) an what API to use.
+ *
+ * Shorthand - instead of { get, set, api? } object it's possible to use string
+ * in case default api is used and get = set
+ *
+ * If no api is specified, defaultApi is used (see above)
+ */
+export const settingsMap = {
+ 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: {
+ get: 'pleroma.accepts_chat_messages',
+ set: 'accepts_chat_messages'
+ },
+ allowFollowingMove: {
+ get: 'pleroma.allow_following_move',
+ set: 'allow_following_move'
+ },
+ discoverable: {
+ get: 'source.pleroma.discoverable',
+ set: 'discoverable'
+ },
+ hideFavorites: {
+ get: 'pleroma.hide_favorites',
+ set: 'hide_favorites'
+ },
+ hideFollowers: {
+ get: 'pleroma.hide_followers',
+ set: 'hide_followers'
+ },
+ hideFollows: {
+ get: 'pleroma.hide_follows',
+ set: 'hide_follows'
+ },
+ hideFollowersCount: {
+ get: 'pleroma.hide_followers_count',
+ set: 'hide_followers_count'
+ },
+ hideFollowsCount: {
+ get: 'pleroma.hide_follows_count',
+ set: 'hide_follows_count'
+ },
+ // NotificationSettingsAPIs
+ webPushHideContents: {
+ get: 'pleroma.notification_settings.hide_notification_contents',
+ set: 'hide_notification_contents',
+ api: notificationsApi
+ },
+ blockNotificationsFromStrangers: {
+ get: 'pleroma.notification_settings.block_from_strangers',
+ set: 'block_from_strangers',
+ api: notificationsApi
+ }
+}
+
+export const defaultState = Object.fromEntries(Object.keys(settingsMap).map(key => [key, null]))
+
+const profileConfig = {
+ state: { ...defaultState },
+ mutations: {
+ confirmProfileOption (state, { name, value }) {
+ set(state, name, value)
+ },
+ wipeProfileOption (state, { name }) {
+ set(state, name, null)
+ },
+ wipeAllProfileOptions (state) {
+ Object.keys(settingsMap).forEach(key => {
+ set(state, key, null)
+ })
+ },
+ // Set the settings based on their path location
+ setCurrentUser (state, user) {
+ Object.entries(settingsMap).forEach((map) => {
+ const [name, value] = map
+ const { get: path = value } = value
+ set(state, name, get(user._original, path))
+ })
+ }
+ },
+ actions: {
+ setProfileOption ({ rootState, state, commit, dispatch }, { name, value }) {
+ const oldValue = get(state, name)
+ const map = settingsMap[name]
+ if (!map) throw new Error('Invalid server-side setting')
+ const { set: path = map, api = defaultApi } = map
+ commit('wipeProfileOption', { name })
+
+ api({ rootState, commit }, { path, value, oldValue })
+ .catch((e) => {
+ console.warn('Error setting server-side option:', e)
+ commit('confirmProfileOption', { name, value: oldValue })
+ })
+ },
+ logout ({ commit }) {
+ commit('wipeAllProfileOptions')
+ }
+ }
+}
+
+export default profileConfig
diff --git a/src/modules/serverSideConfig.js b/src/modules/serverSideConfig.js
deleted file mode 100644
index 476263bc..00000000
--- a/src/modules/serverSideConfig.js
+++ /dev/null
@@ -1,140 +0,0 @@
-import { get, set } from 'lodash'
-
-const defaultApi = ({ rootState, commit }, { path, value }) => {
- const params = {}
- set(params, path, value)
- return rootState
- .api
- .backendInteractor
- .updateProfile({ params })
- .then(result => {
- commit('addNewUsers', [result])
- commit('setCurrentUser', result)
- })
-}
-
-const notificationsApi = ({ rootState, commit }, { path, value, oldValue }) => {
- const settings = {}
- set(settings, path, value)
- return rootState
- .api
- .backendInteractor
- .updateNotificationSettings({ settings })
- .then(result => {
- if (result.status === 'success') {
- commit('confirmServerSideOption', { name, value })
- } else {
- commit('confirmServerSideOption', { name, value: oldValue })
- }
- })
-}
-
-/**
- * Map that stores relation between path for reading (from user profile),
- * for writing (into API) an what API to use.
- *
- * Shorthand - instead of { get, set, api? } object it's possible to use string
- * in case default api is used and get = set
- *
- * If no api is specified, defaultApi is used (see above)
- */
-export const settingsMap = {
- 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: {
- get: 'pleroma.accepts_chat_messages',
- set: 'accepts_chat_messages'
- },
- allowFollowingMove: {
- get: 'pleroma.allow_following_move',
- set: 'allow_following_move'
- },
- discoverable: {
- get: 'source.pleroma.discoverable',
- set: 'discoverable'
- },
- hideFavorites: {
- get: 'pleroma.hide_favorites',
- set: 'hide_favorites'
- },
- hideFollowers: {
- get: 'pleroma.hide_followers',
- set: 'hide_followers'
- },
- hideFollows: {
- get: 'pleroma.hide_follows',
- set: 'hide_follows'
- },
- hideFollowersCount: {
- get: 'pleroma.hide_followers_count',
- set: 'hide_followers_count'
- },
- hideFollowsCount: {
- get: 'pleroma.hide_follows_count',
- set: 'hide_follows_count'
- },
- // NotificationSettingsAPIs
- webPushHideContents: {
- get: 'pleroma.notification_settings.hide_notification_contents',
- set: 'hide_notification_contents',
- api: notificationsApi
- },
- blockNotificationsFromStrangers: {
- get: 'pleroma.notification_settings.block_from_strangers',
- set: 'block_from_strangers',
- api: notificationsApi
- }
-}
-
-export const defaultState = Object.fromEntries(Object.keys(settingsMap).map(key => [key, null]))
-
-const serverSideConfig = {
- state: { ...defaultState },
- mutations: {
- confirmServerSideOption (state, { name, value }) {
- set(state, name, value)
- },
- wipeServerSideOption (state, { name }) {
- set(state, name, null)
- },
- wipeAllServerSideOptions (state) {
- Object.keys(settingsMap).forEach(key => {
- set(state, key, null)
- })
- },
- // Set the settings based on their path location
- setCurrentUser (state, user) {
- Object.entries(settingsMap).forEach((map) => {
- const [name, value] = map
- const { get: path = value } = value
- set(state, name, get(user._original, path))
- })
- }
- },
- actions: {
- setServerSideOption ({ rootState, state, commit, dispatch }, { name, value }) {
- const oldValue = get(state, name)
- const map = settingsMap[name]
- if (!map) throw new Error('Invalid server-side setting')
- const { set: path = map, api = defaultApi } = map
- commit('wipeServerSideOption', { name })
-
- api({ rootState, commit }, { path, value, oldValue })
- .catch((e) => {
- console.warn('Error setting server-side option:', e)
- commit('confirmServerSideOption', { name, value: oldValue })
- })
- },
- logout ({ commit }) {
- commit('wipeAllServerSideOptions')
- }
- }
-}
-
-export default serverSideConfig
--
cgit v1.2.3-70-g09d2
From 6a7b182af11af6c50439c62bc5ee37cc5960810e Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Sun, 12 Mar 2023 17:11:20 +0200
Subject: fixes for stuff i missed
---
.../settings_modal/helpers/boolean_setting.vue | 2 +-
src/components/settings_modal/helpers/setting.js | 2 +-
.../helpers/shared_computed_object.js | 3 +++
src/components/settings_modal/tabs/general_tab.vue | 2 +-
.../tabs/security_tab/security_tab.vue | 22 +++++++++++-----------
5 files changed, 17 insertions(+), 14 deletions(-)
(limited to 'src/components/settings_modal/tabs')
diff --git a/src/components/settings_modal/helpers/boolean_setting.vue b/src/components/settings_modal/helpers/boolean_setting.vue
index bc014bc9..260ee75e 100644
--- a/src/components/settings_modal/helpers/boolean_setting.vue
+++ b/src/components/settings_modal/helpers/boolean_setting.vue
@@ -19,7 +19,7 @@
:changed="isChanged"
:onclick="reset"
/>
-
+
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
index dc37675c..a766e6dc 100644
--- a/src/components/settings_modal/helpers/setting.js
+++ b/src/components/settings_modal/helpers/setting.js
@@ -62,7 +62,7 @@ export default {
return get(this.$store.getters.defaultConfig, this.path)
}
},
- isProfileTied () {
+ isProfileSetting () {
return this.source === 'profile'
},
isChanged () {
diff --git a/src/components/settings_modal/helpers/shared_computed_object.js b/src/components/settings_modal/helpers/shared_computed_object.js
index b8a016e6..912999ce 100644
--- a/src/components/settings_modal/helpers/shared_computed_object.js
+++ b/src/components/settings_modal/helpers/shared_computed_object.js
@@ -4,6 +4,9 @@ const SharedComputedObject = () => ({
},
expertLevel () {
return this.$store.getters.mergedConfig.expertLevel > 0
+ },
+ mergedConfig () {
+ return this.$store.getters.mergedConfig
}
})
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
index 0eb3d06c..eb2cef9b 100644
--- a/src/components/settings_modal/tabs/general_tab.vue
+++ b/src/components/settings_modal/tabs/general_tab.vue
@@ -210,7 +210,7 @@
-
diff --git a/src/components/settings_modal/tabs/security_tab/security_tab.vue b/src/components/settings_modal/tabs/security_tab/security_tab.vue
index 6e03bef4..d36d478f 100644
--- a/src/components/settings_modal/tabs/security_tab/security_tab.vue
+++ b/src/components/settings_modal/tabs/security_tab/security_tab.vue
@@ -143,8 +143,8 @@
/>
-
foo@example.org
-
+
@@ -175,16 +175,16 @@
{{ $t('settings.move_account') }}
{{ $t('settings.move_account_notes') }}
-
-
- foo@example.org
-
-
+
+
+ foo@example.org
+
+
+
--
cgit v1.2.3-70-g09d2
From 55ea6df40b7e2cfe2b1b5bde33204d4c03e54a12 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Sun, 12 Mar 2023 17:28:14 +0200
Subject: lint
---
.../interface_language_switcher.vue | 4 ++-
.../settings_modal/tabs/filtering_tab.vue | 12 ++++----
src/components/settings_modal/tabs/general_tab.vue | 11 +++----
.../settings_modal/tabs/notifications_tab.vue | 8 +++--
src/components/settings_modal/tabs/profile_tab.vue | 34 +++++++++++++++++-----
5 files changed, 47 insertions(+), 22 deletions(-)
(limited to 'src/components/settings_modal/tabs')
diff --git a/src/components/interface_language_switcher/interface_language_switcher.vue b/src/components/interface_language_switcher/interface_language_switcher.vue
index a57e8761..364791a1 100644
--- a/src/components/interface_language_switcher/interface_language_switcher.vue
+++ b/src/components/interface_language_switcher/interface_language_switcher.vue
@@ -36,7 +36,9 @@
+ >
+ {{ $t('settings.add_language') }}
+
diff --git a/src/components/settings_modal/tabs/filtering_tab.vue b/src/components/settings_modal/tabs/filtering_tab.vue
index 46c6bc5c..41d1b54f 100644
--- a/src/components/settings_modal/tabs/filtering_tab.vue
+++ b/src/components/settings_modal/tabs/filtering_tab.vue
@@ -10,8 +10,8 @@
-
{{ $t('settings.hide_wordfiltered_statuses') }}
@@ -20,8 +20,8 @@
-
{{ $t('settings.hide_muted_threads') }}
@@ -30,8 +30,8 @@
-
{{ $t('settings.hide_muted_posts') }}
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
index eb2cef9b..641d850a 100644
--- a/src/components/settings_modal/tabs/general_tab.vue
+++ b/src/components/settings_modal/tabs/general_tab.vue
@@ -33,7 +33,7 @@
-
{{ $t('settings.pause_on_unfocused') }}
@@ -262,7 +262,8 @@
-
{{ $t('settings.no_rich_text_description') }}
@@ -287,7 +288,7 @@
{{ $t('settings.preload_images') }}
@@ -296,7 +297,7 @@
{{ $t('settings.use_one_click_nsfw') }}
@@ -314,7 +315,7 @@
{{ $t('settings.loop_video_silent_only') }}
diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue
index ea095372..fcb92135 100644
--- a/src/components/settings_modal/tabs/notifications_tab.vue
+++ b/src/components/settings_modal/tabs/notifications_tab.vue
@@ -4,7 +4,10 @@
{{ $t('settings.notification_setting_filters') }}
-
-
+
{{ $t('settings.notification_setting_block_from_strangers') }}
@@ -67,7 +70,8 @@
-
{{ $t('settings.notification_setting_hide_notification_contents') }}
diff --git a/src/components/settings_modal/tabs/profile_tab.vue b/src/components/settings_modal/tabs/profile_tab.vue
index 74652990..1cc850cb 100644
--- a/src/components/settings_modal/tabs/profile_tab.vue
+++ b/src/components/settings_modal/tabs/profile_tab.vue
@@ -254,27 +254,42 @@
{{ $t('settings.account_privacy') }}
-
-
+
{{ $t('settings.lock_account_description') }}
-
-
+
{{ $t('settings.discoverable') }}
-
-
+
{{ $t('settings.allow_following_move') }}
-
-
+
{{ $t('settings.hide_favorites_description') }}
-
-
+
{{ $t('settings.hide_followers_description') }}
@@ -282,7 +297,7 @@
{{ $t('settings.hide_followers_count_description') }}
@@ -290,7 +305,10 @@
-
-
+
{{ $t('settings.hide_follows_description') }}
@@ -298,7 +316,7 @@
{{ $t('settings.hide_follows_count_description') }}
--
cgit v1.2.3-70-g09d2
From 3403f6a1ed5388291244487ae7eb3190d7c4353e Mon Sep 17 00:00:00 2001
From: Alexander Tumin
Date: Fri, 17 Mar 2023 23:30:46 +0300
Subject: Allow custom emoji reactions: add option to scale reaction buttons
---
src/components/emoji_reactions/emoji_reactions.vue | 27 ++++++++++++++--------
src/components/settings_modal/tabs/general_tab.vue | 9 ++++++++
src/i18n/en.json | 1 +
src/modules/config.js | 2 ++
src/services/style_setter/style_setter.js | 4 ++--
5 files changed, 32 insertions(+), 11 deletions(-)
(limited to 'src/components/settings_modal/tabs')
diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue
index 12783114..eb46018e 100644
--- a/src/components/emoji_reactions/emoji_reactions.vue
+++ b/src/components/emoji_reactions/emoji_reactions.vue
@@ -12,20 +12,20 @@
@mouseenter="fetchEmojiReactionsByIfMissing()"
>
+ {{ reaction.name }}
- {{ reaction.name }}
{{ reaction.count }}
@@ -49,6 +49,8 @@
margin-top: 0.25em;
flex-wrap: wrap;
+ --emoji-size: calc(1.25em * var(--emojiReactionsScale, 1));
+
.emoji-reaction {
padding: 0 0.5em;
margin-right: 0.5em;
@@ -59,17 +61,24 @@
box-sizing: border-box;
.reaction-emoji {
- width: 1.25em;
- height: 1.25em;
+ width: var(--emoji-size);
+ height: var(--emoji-size);
margin-right: 0.25em;
+ line-height: var(--emoji-size);
+ display: flex;
+ justify-content: center;
+ align-items: center;
}
.reaction-emoji-content {
- max-width: 1.25em;
- max-height: 1.25em;
+ max-width: 100%;
+ max-height: 100%;
width: auto;
height: auto;
+ line-height: inherit;
overflow: hidden;
+ font-size: calc(var(--emoji-size) * 0.8);
+ margin: 0;
}
&:focus {
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
index 65248ac1..17afc5ba 100644
--- a/src/components/settings_modal/tabs/general_tab.vue
+++ b/src/components/settings_modal/tabs/general_tab.vue
@@ -271,6 +271,15 @@
{{ $t('settings.no_rich_text_description') }}
+ -
+
+ {{ $t('settings.emoji_reactions_scale') }}
+
+
{{ $t('settings.attachments') }}
-
{
body.classList.remove('hidden')
}
-const configColumns = ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth }) =>
- ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth })
+const configColumns = ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth, emojiReactionsScale }) =>
+ ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth, emojiReactionsScale })
const defaultConfigColumns = configColumns(defaultState)
--
cgit v1.2.3-70-g09d2
From 493120b5456282756d05d9afaf66b11a2f87d8fc Mon Sep 17 00:00:00 2001
From: Alexander Tumin
Date: Sat, 18 Mar 2023 20:48:36 +0300
Subject: Generalize IntegerSetting into NumberSetting, add Integer/Float
wrappers
---
.../settings_modal/helpers/float_setting.vue | 16 +++++++
.../settings_modal/helpers/integer_setting.js | 44 -----------------
.../settings_modal/helpers/integer_setting.vue | 36 +++++---------
.../settings_modal/helpers/number_setting.js | 56 ++++++++++++++++++++++
.../settings_modal/helpers/number_setting.vue | 27 +++++++++++
src/components/settings_modal/tabs/general_tab.js | 2 +
src/components/settings_modal/tabs/general_tab.vue | 4 +-
7 files changed, 116 insertions(+), 69 deletions(-)
create mode 100644 src/components/settings_modal/helpers/float_setting.vue
delete mode 100644 src/components/settings_modal/helpers/integer_setting.js
create mode 100644 src/components/settings_modal/helpers/number_setting.js
create mode 100644 src/components/settings_modal/helpers/number_setting.vue
(limited to 'src/components/settings_modal/tabs')
diff --git a/src/components/settings_modal/helpers/float_setting.vue b/src/components/settings_modal/helpers/float_setting.vue
new file mode 100644
index 00000000..15edb3c3
--- /dev/null
+++ b/src/components/settings_modal/helpers/float_setting.vue
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
diff --git a/src/components/settings_modal/helpers/integer_setting.js b/src/components/settings_modal/helpers/integer_setting.js
deleted file mode 100644
index e64d0cee..00000000
--- a/src/components/settings_modal/helpers/integer_setting.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import { get, set } from 'lodash'
-import ModifiedIndicator from './modified_indicator.vue'
-export default {
- components: {
- ModifiedIndicator
- },
- props: {
- path: String,
- disabled: Boolean,
- min: Number,
- expert: [Number, String]
- },
- computed: {
- pathDefault () {
- const [firstSegment, ...rest] = this.path.split('.')
- return [firstSegment + 'DefaultValue', ...rest].join('.')
- },
- state () {
- const value = get(this.$parent, this.path)
- if (value === undefined) {
- return this.defaultState
- } else {
- return value
- }
- },
- defaultState () {
- return get(this.$parent, this.pathDefault)
- },
- isChanged () {
- return this.state !== this.defaultState
- },
- matchesExpertLevel () {
- return (this.expert || 0) <= this.$parent.expertLevel
- }
- },
- methods: {
- update (e) {
- set(this.$parent, this.path, parseInt(e.target.value))
- },
- reset () {
- set(this.$parent, this.path, this.defaultState)
- }
- }
-}
diff --git a/src/components/settings_modal/helpers/integer_setting.vue b/src/components/settings_modal/helpers/integer_setting.vue
index 695e2673..43fa7e1a 100644
--- a/src/components/settings_modal/helpers/integer_setting.vue
+++ b/src/components/settings_modal/helpers/integer_setting.vue
@@ -1,27 +1,17 @@
-
-
-
- {{ ' ' }}
-
-
+
+
-
+
diff --git a/src/components/settings_modal/helpers/number_setting.js b/src/components/settings_modal/helpers/number_setting.js
new file mode 100644
index 00000000..73c39948
--- /dev/null
+++ b/src/components/settings_modal/helpers/number_setting.js
@@ -0,0 +1,56 @@
+import { get, set } from 'lodash'
+import ModifiedIndicator from './modified_indicator.vue'
+export default {
+ components: {
+ ModifiedIndicator
+ },
+ props: {
+ path: String,
+ disabled: Boolean,
+ min: Number,
+ step: Number,
+ truncate: Number,
+ expert: [Number, String]
+ },
+ computed: {
+ pathDefault () {
+ const [firstSegment, ...rest] = this.path.split('.')
+ return [firstSegment + 'DefaultValue', ...rest].join('.')
+ },
+ parent () {
+ return this.$parent.$parent
+ },
+ state () {
+ const value = get(this.parent, this.path)
+ if (value === undefined) {
+ return this.defaultState
+ } else {
+ return value
+ }
+ },
+ defaultState () {
+ return get(this.parent, this.pathDefault)
+ },
+ isChanged () {
+ return this.state !== this.defaultState
+ },
+ matchesExpertLevel () {
+ return (this.expert || 0) <= this.parent.expertLevel
+ }
+ },
+ methods: {
+ truncateValue (value) {
+ if (!this.truncate) {
+ return value
+ }
+
+ return Math.trunc(value / this.truncate) * this.truncate
+ },
+ update (e) {
+ set(this.parent, this.path, this.truncateValue(parseFloat(e.target.value)))
+ },
+ reset () {
+ set(this.parent, this.path, this.defaultState)
+ }
+ }
+}
diff --git a/src/components/settings_modal/helpers/number_setting.vue b/src/components/settings_modal/helpers/number_setting.vue
new file mode 100644
index 00000000..3eab5178
--- /dev/null
+++ b/src/components/settings_modal/helpers/number_setting.vue
@@ -0,0 +1,27 @@
+
+
+
+
+ {{ ' ' }}
+
+
+
+
+
diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js
index ea24d6ad..be97710f 100644
--- a/src/components/settings_modal/tabs/general_tab.js
+++ b/src/components/settings_modal/tabs/general_tab.js
@@ -2,6 +2,7 @@ import BooleanSetting from '../helpers/boolean_setting.vue'
import ChoiceSetting from '../helpers/choice_setting.vue'
import ScopeSelector from 'src/components/scope_selector/scope_selector.vue'
import IntegerSetting from '../helpers/integer_setting.vue'
+import FloatSetting from '../helpers/float_setting.vue'
import SizeSetting, { defaultHorizontalUnits } from '../helpers/size_setting.vue'
import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
@@ -62,6 +63,7 @@ const GeneralTab = {
BooleanSetting,
ChoiceSetting,
IntegerSetting,
+ FloatSetting,
SizeSetting,
InterfaceLanguageSwitcher,
ScopeSelector,
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
index 17afc5ba..21e2d855 100644
--- a/src/components/settings_modal/tabs/general_tab.vue
+++ b/src/components/settings_modal/tabs/general_tab.vue
@@ -272,13 +272,13 @@
-
-
{{ $t('settings.emoji_reactions_scale') }}
-
+
{{ $t('settings.attachments') }}
-
--
cgit v1.2.3-70-g09d2