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')
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')
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"
>
-
+
+
+
-
+
+
+
Object.keys(props).reduce((acc, cur) => {
+ acc[kebabCase(cur)] = props[cur]
+ return acc
+}, {})
+
+export { propsToNative }
--
cgit v1.2.3-70-g09d2
From ce8101e60a1dc1a768f793a34fb6e9cca70b4858 Mon Sep 17 00:00:00 2001
From: Tusooa Zhu
Date: Tue, 27 Sep 2022 18:47:50 -0400
Subject: Add remove follower confirmation
---
src/components/account_actions/account_actions.js | 20 +++++++++++++++-
src/components/account_actions/account_actions.vue | 21 +++++++++++++++++
src/components/follow_card/follow_card.vue | 1 +
.../remove_follower_button.js | 27 ++++++++++++++++++++--
.../remove_follower_button.vue | 21 +++++++++++++++++
src/components/settings_modal/tabs/general_tab.vue | 5 ++++
src/i18n/en.json | 5 ++++
src/modules/config.js | 1 +
src/modules/instance.js | 1 +
9 files changed, 99 insertions(+), 3 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js
index 7dec0c3d..acd93e06 100644
--- a/src/components/account_actions/account_actions.js
+++ b/src/components/account_actions/account_actions.js
@@ -18,7 +18,8 @@ const AccountActions = {
],
data () {
return {
- showingConfirmBlock: false
+ showingConfirmBlock: false,
+ showingConfirmRemoveFollower: false
}
},
components: {
@@ -34,6 +35,12 @@ const AccountActions = {
hideConfirmBlock () {
this.showingConfirmBlock = false
},
+ showConfirmRemoveUserFromFollowers () {
+ this.showingConfirmRemoveFollower = true
+ },
+ hideConfirmRemoveUserFromFollowers () {
+ this.showingConfirmRemoveFollower = false
+ },
showRepeats () {
this.$store.dispatch('showReblogs', this.user.id)
},
@@ -55,7 +62,15 @@ const AccountActions = {
this.$store.dispatch('unblockUser', this.user.id)
},
removeUserFromFollowers () {
+ if (!this.shouldConfirmRemoveUserFromFollowers) {
+ this.doRemoveUserFromFollowers()
+ } else {
+ this.showConfirmRemoveUserFromFollowers()
+ }
+ },
+ doRemoveUserFromFollowers () {
this.$store.dispatch('removeUserFromFollowers', this.user.id)
+ this.hideConfirmRemoveUserFromFollowers()
},
reportUser () {
this.$store.dispatch('openUserReportingModal', { userId: this.user.id })
@@ -71,6 +86,9 @@ const AccountActions = {
shouldConfirmBlock () {
return this.$store.getters.mergedConfig.modalOnBlock
},
+ shouldConfirmRemoveUserFromFollowers () {
+ return this.$store.getters.mergedConfig.modalOnRemoveUserFromFollowers
+ },
...mapState({
pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable
})
diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue
index 161bab09..ce19291a 100644
--- a/src/components/account_actions/account_actions.vue
+++ b/src/components/account_actions/account_actions.vue
@@ -95,6 +95,27 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/components/follow_card/follow_card.vue b/src/components/follow_card/follow_card.vue
index eff69fb2..bdb6b809 100644
--- a/src/components/follow_card/follow_card.vue
+++ b/src/components/follow_card/follow_card.vue
@@ -24,6 +24,7 @@
/>
diff --git a/src/components/remove_follower_button/remove_follower_button.js b/src/components/remove_follower_button/remove_follower_button.js
index e1a7531b..052a519f 100644
--- a/src/components/remove_follower_button/remove_follower_button.js
+++ b/src/components/remove_follower_button/remove_follower_button.js
@@ -1,10 +1,16 @@
+import ConfirmModal from '../confirm_modal/confirm_modal.vue'
+
export default {
- props: ['relationship'],
+ props: ['user', 'relationship'],
data () {
return {
- inProgress: false
+ inProgress: false,
+ showingConfirmRemoveFollower: false
}
},
+ components: {
+ ConfirmModal
+ },
computed: {
label () {
if (this.inProgress) {
@@ -12,14 +18,31 @@ export default {
} else {
return this.$t('user_card.remove_follower')
}
+ },
+ shouldConfirmRemoveUserFromFollowers () {
+ return this.$store.getters.mergedConfig.modalOnRemoveUserFromFollowers
}
},
methods: {
+ showConfirmRemoveUserFromFollowers () {
+ this.showingConfirmRemoveFollower = true
+ },
+ hideConfirmRemoveUserFromFollowers () {
+ this.showingConfirmRemoveFollower = false
+ },
onClick () {
+ if (!this.shouldConfirmRemoveUserFromFollowers) {
+ this.doRemoveUserFromFollowers()
+ } else {
+ this.showConfirmRemoveUserFromFollowers()
+ }
+ },
+ doRemoveUserFromFollowers () {
this.inProgress = true
this.$store.dispatch('removeUserFromFollowers', this.relationship.id).then(() => {
this.inProgress = false
})
+ this.hideConfirmRemoveUserFromFollowers()
}
}
}
diff --git a/src/components/remove_follower_button/remove_follower_button.vue b/src/components/remove_follower_button/remove_follower_button.vue
index a3a4c242..0012aebd 100644
--- a/src/components/remove_follower_button/remove_follower_button.vue
+++ b/src/components/remove_follower_button/remove_follower_button.vue
@@ -7,6 +7,27 @@
@click="onClick"
>
{{ label }}
+
+
+
+
+
+
+
+
+
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 902954b29825647eaf5435c89e379ef4babe7931 Mon Sep 17 00:00:00 2001
From: tusooa
Date: Thu, 9 Feb 2023 21:35:56 -0500
Subject: Use class to style screenreader-only text
---
src/App.scss | 14 ++++++++++++--
src/_mixins.scss | 12 ------------
src/components/checkbox/checkbox.vue | 3 +--
.../screen_reader_notice/screen_reader_notice.vue | 10 +---------
.../settings_modal/helpers/modified_indicator.vue | 2 +-
5 files changed, 15 insertions(+), 26 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/App.scss b/src/App.scss
index 1c4c8941..3f352e8d 100644
--- a/src/App.scss
+++ b/src/App.scss
@@ -580,8 +580,6 @@ textarea,
}
&[type="checkbox"] {
- display: none;
-
&:checked + label::before {
color: $fallback--text;
color: var(--inputText, $fallback--text);
@@ -887,3 +885,15 @@ option {
opacity: 0;
}
/* stylelint-enable no-descending-specificity */
+
+.visible-for-screenreader-only {
+ display: block;
+ width: 1px;
+ height: 1px;
+ margin: -1px;
+ overflow: hidden;
+ visibility: visible;
+ clip: rect(0 0 0 0);
+ padding: 0;
+ position: absolute;
+}
diff --git a/src/_mixins.scss b/src/_mixins.scss
index 677bc210..e99fe26f 100644
--- a/src/_mixins.scss
+++ b/src/_mixins.scss
@@ -16,15 +16,3 @@
@content;
}
}
-
-@mixin visible-for-screenreader-only {
- display: block;
- width: 1px;
- height: 1px;
- margin: -1px;
- overflow: hidden;
- visibility: visible;
- clip: rect(0 0 0 0);
- padding: 0;
- position: absolute;
-}
diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue
index ac7acd52..42f89be9 100644
--- a/src/components/checkbox/checkbox.vue
+++ b/src/components/checkbox/checkbox.vue
@@ -5,6 +5,7 @@
>
{{ currentText }}
@@ -8,11 +8,3 @@
-
-
diff --git a/src/components/settings_modal/helpers/modified_indicator.vue b/src/components/settings_modal/helpers/modified_indicator.vue
index 8311533a..45db3fc2 100644
--- a/src/components/settings_modal/helpers/modified_indicator.vue
+++ b/src/components/settings_modal/helpers/modified_indicator.vue
@@ -5,12 +5,12 @@
>
--
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')
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')
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')
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.default_vis') }}
+ {{ $t('settings.default_vis') }}
-
+
{{ $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 ac32997f8b17ba3f2209c992c27394c48a1594c7 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Sun, 12 Mar 2023 16:51:50 +0200
Subject: move websocket connection logic into module
---
.../helpers/shared_computed_object.js | 19 +-----
src/modules/config.js | 70 ++++++++++++++--------
2 files changed, 46 insertions(+), 43 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/helpers/shared_computed_object.js b/src/components/settings_modal/helpers/shared_computed_object.js
index 6b22174d..e898c8ac 100644
--- a/src/components/settings_modal/helpers/shared_computed_object.js
+++ b/src/components/settings_modal/helpers/shared_computed_object.js
@@ -12,24 +12,7 @@ const SharedComputedObject = () => ({
this.$store.dispatch('setOption', { 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 },
- set (value) {
- const promise = value
- ? this.$store.dispatch('enableMastoSockets')
- : this.$store.dispatch('disableMastoSockets')
-
- promise.then(() => {
- this.$store.dispatch('setOption', { name: 'useStreamingApi', value })
- }).catch((e) => {
- console.error('Failed starting MastoAPI Streaming socket', e)
- this.$store.dispatch('disableMastoSockets')
- this.$store.dispatch('setOption', { name: 'useStreamingApi', value: false })
- })
- }
- }
+ .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
})
export default SharedComputedObject
diff --git a/src/modules/config.js b/src/modules/config.js
index 6ab59d6d..5e3f0105 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -178,31 +178,51 @@ const config = {
commit('setHighlight', { user, color, type })
},
setOption ({ commit, dispatch, state }, { name, value }) {
- commit('setOption', { name, value })
- switch (name) {
- case 'theme':
- setPreset(value)
- break
- case 'sidebarColumnWidth':
- case 'contentColumnWidth':
- case 'notifsColumnWidth':
- applyConfig(state)
- break
- case 'customTheme':
- case 'customThemeSource':
- applyTheme(value)
- break
- case 'interfaceLanguage':
- messages.setLanguage(this.getters.i18n, value)
- dispatch('loadUnicodeEmojiData', value)
- Cookies.set(
- BACKEND_LANGUAGE_COOKIE_NAME,
- localeService.internalToBackendLocaleMulti(value)
- )
- break
- case 'thirdColumnMode':
- dispatch('setLayoutWidth', undefined)
- break
+ const exceptions = new Set([
+ 'useStreamingApi'
+ ])
+
+ if (exceptions.has(name)) {
+ switch (name) {
+ case 'useStreamingApi': {
+ const action = value ? 'enableMastoSockets' : 'disableMastoSockets'
+
+ dispatch(action).then(() => {
+ commit('setOption', { name: 'useStreamingApi', value })
+ }).catch((e) => {
+ console.error('Failed starting MastoAPI Streaming socket', e)
+ dispatch('disableMastoSockets')
+ dispatch('setOption', { name: 'useStreamingApi', value: false })
+ })
+ }
+ }
+ } else {
+ commit('setOption', { name, value })
+ switch (name) {
+ case 'theme':
+ setPreset(value)
+ break
+ case 'sidebarColumnWidth':
+ case 'contentColumnWidth':
+ case 'notifsColumnWidth':
+ applyConfig(state)
+ break
+ case 'customTheme':
+ case 'customThemeSource':
+ applyTheme(value)
+ break
+ case 'interfaceLanguage':
+ messages.setLanguage(this.getters.i18n, value)
+ dispatch('loadUnicodeEmojiData', value)
+ Cookies.set(
+ BACKEND_LANGUAGE_COOKIE_NAME,
+ localeService.internalToBackendLocaleMulti(value)
+ )
+ break
+ case 'thirdColumnMode':
+ dispatch('setLayoutWidth', undefined)
+ break
+ }
}
}
}
--
cgit v1.2.3-70-g09d2
From 947b73f8702ff4b7c5f74620204e86a4f375315c Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Sun, 12 Mar 2023 16:55:39 +0200
Subject: minimize the rest of the sharedcomputedobject
---
.../settings_modal/helpers/shared_computed_object.js | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/helpers/shared_computed_object.js b/src/components/settings_modal/helpers/shared_computed_object.js
index e898c8ac..b8a016e6 100644
--- a/src/components/settings_modal/helpers/shared_computed_object.js
+++ b/src/components/settings_modal/helpers/shared_computed_object.js
@@ -1,18 +1,10 @@
-import { defaultState as configDefaultState } from 'src/modules/config.js'
-
const SharedComputedObject = () => ({
user () {
return this.$store.state.users.currentUser
},
- // Generating computed values for vuex properties
- ...Object.keys(configDefaultState)
- .map(key => [key, {
- get () { return this.$store.getters.mergedConfig[key] },
- set (value) {
- this.$store.dispatch('setOption', { name: key, value })
- }
- }])
- .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
+ expertLevel () {
+ return this.$store.getters.mergedConfig.expertLevel > 0
+ }
})
export default SharedComputedObject
--
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')
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')
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') }}
+ >
+ {{ $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 4d23d31fecf480abfccc4db3ac79c6640078dc3b Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Tue, 14 Mar 2023 21:50:43 +0200
Subject: initial admin settings prototype (WIP)
---
src/components/admin_modal/admin_modal.js | 68 ++++++++++++
src/components/admin_modal/admin_modal.scss | 80 ++++++++++++++
src/components/admin_modal/admin_modal.vue | 121 +++++++++++++++++++++
src/components/admin_modal/admin_modal_content.js | 88 +++++++++++++++
.../admin_modal/admin_modal_content.scss | 56 ++++++++++
src/components/admin_modal/tabs/general_tab.js | 33 ++++++
src/components/desktop_nav/desktop_nav.js | 5 +-
src/components/desktop_nav/desktop_nav.vue | 9 +-
src/components/notification/notification.vue | 2 +-
.../settings_modal/admin_tabs/instance_tab.js | 29 +++++
.../settings_modal/admin_tabs/instance_tab.vue | 35 ++++++
src/components/settings_modal/helpers/setting.js | 14 ++-
.../settings_modal/helpers/string_setting.js | 9 ++
.../settings_modal/helpers/string_setting.vue | 25 +++++
src/components/settings_modal/settings_modal.js | 23 +++-
src/components/settings_modal/settings_modal.vue | 3 +-
.../settings_modal/settings_modal_admin_content.js | 76 +++++++++++++
.../settings_modal_admin_content.scss | 56 ++++++++++
.../settings_modal_admin_content.vue | 21 ++++
.../settings_modal/settings_modal_content.js | 88 ---------------
.../settings_modal/settings_modal_content.scss | 56 ----------
.../settings_modal/settings_modal_content.vue | 83 --------------
.../settings_modal/settings_modal_user_content.js | 88 +++++++++++++++
.../settings_modal_user_content.scss | 56 ++++++++++
.../settings_modal/settings_modal_user_content.vue | 83 ++++++++++++++
src/components/tab_switcher/tab_switcher.jsx | 8 +-
src/modules/adminSettings.js | 5 +-
src/modules/interface.js | 21 +++-
28 files changed, 985 insertions(+), 256 deletions(-)
create mode 100644 src/components/admin_modal/admin_modal.js
create mode 100644 src/components/admin_modal/admin_modal.scss
create mode 100644 src/components/admin_modal/admin_modal.vue
create mode 100644 src/components/admin_modal/admin_modal_content.js
create mode 100644 src/components/admin_modal/admin_modal_content.scss
create mode 100644 src/components/admin_modal/tabs/general_tab.js
create mode 100644 src/components/settings_modal/admin_tabs/instance_tab.js
create mode 100644 src/components/settings_modal/admin_tabs/instance_tab.vue
create mode 100644 src/components/settings_modal/helpers/string_setting.js
create mode 100644 src/components/settings_modal/helpers/string_setting.vue
create mode 100644 src/components/settings_modal/settings_modal_admin_content.js
create mode 100644 src/components/settings_modal/settings_modal_admin_content.scss
create mode 100644 src/components/settings_modal/settings_modal_admin_content.vue
delete mode 100644 src/components/settings_modal/settings_modal_content.js
delete mode 100644 src/components/settings_modal/settings_modal_content.scss
delete mode 100644 src/components/settings_modal/settings_modal_content.vue
create mode 100644 src/components/settings_modal/settings_modal_user_content.js
create mode 100644 src/components/settings_modal/settings_modal_user_content.scss
create mode 100644 src/components/settings_modal/settings_modal_user_content.vue
(limited to 'src/components/settings_modal')
diff --git a/src/components/admin_modal/admin_modal.js b/src/components/admin_modal/admin_modal.js
new file mode 100644
index 00000000..525f09aa
--- /dev/null
+++ b/src/components/admin_modal/admin_modal.js
@@ -0,0 +1,68 @@
+import Modal from 'src/components/modal/modal.vue'
+import PanelLoading from 'src/components/panel_loading/panel_loading.vue'
+import AsyncComponentError from 'src/components/async_component_error/async_component_error.vue'
+import getResettableAsyncComponent from 'src/services/resettable_async_component.js'
+import Popover from '../popover/popover.vue'
+import Checkbox from 'src/components/checkbox/checkbox.vue'
+import { library } from '@fortawesome/fontawesome-svg-core'
+import {
+ newImporter,
+ newExporter
+} from 'src/services/export_import/export_import.js'
+import {
+ faTimes,
+ faFileUpload,
+ faFileDownload,
+ faChevronDown
+} from '@fortawesome/free-solid-svg-icons'
+import {
+ faWindowMinimize
+} from '@fortawesome/free-regular-svg-icons'
+
+library.add(
+ faTimes,
+ faWindowMinimize,
+ faFileUpload,
+ faFileDownload,
+ faChevronDown
+)
+
+const AdminModal = {
+ data () {
+ return {}
+ },
+ components: {
+ Modal,
+ Popover,
+ Checkbox,
+ AdminModalContent: getResettableAsyncComponent(
+ () => import('./admin_modal_content.vue'),
+ {
+ loadingComponent: PanelLoading,
+ errorComponent: AsyncComponentError,
+ delay: 0
+ }
+ )
+ },
+ methods: {
+ closeModal () {
+ this.$store.dispatch('closeAdminModal')
+ },
+ peekModal () {
+ this.$store.dispatch('togglePeekAdminModal')
+ }
+ },
+ computed: {
+ modalActivated () {
+ return this.$store.state.interface.adminModalState !== 'hidden'
+ },
+ modalOpenedOnce () {
+ return this.$store.state.interface.adminModalLoaded
+ },
+ modalPeeked () {
+ return this.$store.state.interface.adminModalState === 'minimized'
+ }
+ }
+}
+
+export default AdminModal
diff --git a/src/components/admin_modal/admin_modal.scss b/src/components/admin_modal/admin_modal.scss
new file mode 100644
index 00000000..0d916f32
--- /dev/null
+++ b/src/components/admin_modal/admin_modal.scss
@@ -0,0 +1,80 @@
+@import "src/variables";
+
+.admin-modal {
+ overflow: hidden;
+
+ .setting-list,
+ .option-list {
+ list-style-type: none;
+ padding-left: 2em;
+
+ li {
+ margin-bottom: 0.5em;
+ }
+
+ .suboptions {
+ margin-top: 0.3em;
+ }
+ }
+
+ .admin-modal-panel {
+ overflow: hidden;
+ transition: transform;
+ transition-timing-function: ease-in-out;
+ transition-duration: 300ms;
+ width: 1000px;
+ max-width: 90vw;
+ height: 90vh;
+
+ @media all and (max-width: 800px) {
+ max-width: 100vw;
+ height: 100%;
+ }
+
+ >.panel-body {
+ height: 100%;
+ overflow-y: hidden;
+
+ .btn {
+ min-height: 2em;
+ min-width: 10em;
+ padding: 0 2em;
+ }
+ }
+ }
+
+ .admin-footer {
+ display: flex;
+
+ >* {
+ margin-right: 0.5em;
+ }
+
+ .extra-content {
+ display: flex;
+ flex-grow: 1;
+ }
+ }
+
+ &.peek {
+ .admin-modal-panel {
+ /* Explanation:
+ * Modal is positioned vertically centered.
+ * 100vh - 100% = Distance between modal's top+bottom boundaries and screen
+ * (100vh - 100%) / 2 = Distance between bottom (or top) boundary and screen
+ * + 100% - we move modal completely off-screen, it's top boundary touches
+ * bottom of the screen
+ * - 50px - leaving tiny amount of space so that titlebar + tiny amount of modal is visible
+ */
+ transform: translateY(calc(((100vh - 100%) / 2 + 100%) - 50px));
+
+ @media all and (max-width: 800px) {
+ /* For mobile, the modal takes 100% of the available screen.
+ This ensures the minimized modal is always 50px above the browser bottom
+ bar regardless of whether or not it is visible.
+ */
+ transform: translateY(calc(100% - 50px));
+ }
+ }
+ }
+}
diff --git a/src/components/admin_modal/admin_modal.vue b/src/components/admin_modal/admin_modal.vue
new file mode 100644
index 00000000..d7e5a80f
--- /dev/null
+++ b/src/components/admin_modal/admin_modal.vue
@@ -0,0 +1,121 @@
+
+
+
+
+
+ {{ $t('admin.settings') }}
+
+
+
+ {{ currentSaveStateNotice.error ? $t('admin.saving_err') : $t('settings.saving_ok') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/admin_modal/admin_modal_content.js b/src/components/admin_modal/admin_modal_content.js
new file mode 100644
index 00000000..897cc163
--- /dev/null
+++ b/src/components/admin_modal/admin_modal_content.js
@@ -0,0 +1,88 @@
+import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
+
+import DataImportExportTab from './tabs/data_import_export_tab.vue'
+import MutesAndBlocksTab from './tabs/mutes_and_blocks_tab.vue'
+import NotificationsTab from './tabs/notifications_tab.vue'
+import FilteringTab from './tabs/filtering_tab.vue'
+import SecurityTab from './tabs/security_tab/security_tab.vue'
+import ProfileTab from './tabs/profile_tab.vue'
+import GeneralTab from './tabs/general_tab.vue'
+import VersionTab from './tabs/version_tab.vue'
+import ThemeTab from './tabs/theme_tab/theme_tab.vue'
+
+import { library } from '@fortawesome/fontawesome-svg-core'
+import {
+ faWrench,
+ faUser,
+ faFilter,
+ faPaintBrush,
+ faBell,
+ faDownload,
+ faEyeSlash,
+ faInfo
+} from '@fortawesome/free-solid-svg-icons'
+
+library.add(
+ faWrench,
+ faUser,
+ faFilter,
+ faPaintBrush,
+ faBell,
+ faDownload,
+ faEyeSlash,
+ faInfo
+)
+
+const AdminModalContent = {
+ components: {
+ TabSwitcher,
+
+ DataImportExportTab,
+ MutesAndBlocksTab,
+ NotificationsTab,
+ FilteringTab,
+ SecurityTab,
+ ProfileTab,
+ GeneralTab,
+ VersionTab,
+ ThemeTab
+ },
+ computed: {
+ isLoggedIn () {
+ return !!this.$store.state.users.currentUser
+ },
+ open () {
+ return this.$store.state.interface.AdminModalState !== 'hidden'
+ },
+ bodyLock () {
+ return this.$store.state.interface.AdminModalState === 'visible'
+ }
+ },
+ methods: {
+ onOpen () {
+ const targetTab = this.$store.state.interface.AdminModalTargetTab
+ // We're being told to open in specific tab
+ if (targetTab) {
+ const tabIndex = this.$refs.tabSwitcher.$slots.default().findIndex(elm => {
+ return elm.props && elm.props['data-tab-name'] === targetTab
+ })
+ if (tabIndex >= 0) {
+ this.$refs.tabSwitcher.setTab(tabIndex)
+ }
+ }
+ // Clear the state of target tab, so that next time Admin is opened
+ // it doesn't force it.
+ this.$store.dispatch('clearAdminModalTargetTab')
+ }
+ },
+ mounted () {
+ this.onOpen()
+ },
+ watch: {
+ open: function (value) {
+ if (value) this.onOpen()
+ }
+ }
+}
+
+export default AdminModalContent
diff --git a/src/components/admin_modal/admin_modal_content.scss b/src/components/admin_modal/admin_modal_content.scss
new file mode 100644
index 00000000..2db7b2f8
--- /dev/null
+++ b/src/components/admin_modal/admin_modal_content.scss
@@ -0,0 +1,56 @@
+@import "src/variables";
+
+.admin_tab-switcher {
+ height: 100%;
+
+ .setting-item {
+ border-bottom: 2px solid var(--fg, $fallback--fg);
+ margin: 1em 1em 1.4em;
+ padding-bottom: 1.4em;
+
+ > div,
+ > label {
+ display: block;
+ margin-bottom: 0.5em;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
+ }
+
+ .select-multiple {
+ display: flex;
+
+ .option-list {
+ margin: 0;
+ padding-left: 0.5em;
+ }
+ }
+
+ &:last-child {
+ border-bottom: none;
+ padding-bottom: 0;
+ margin-bottom: 1em;
+ }
+
+ select {
+ min-width: 10em;
+ }
+
+ textarea {
+ width: 100%;
+ max-width: 100%;
+ height: 100px;
+ }
+
+ .unavailable,
+ .unavailable svg {
+ color: var(--cRed, $fallback--cRed);
+ color: $fallback--cRed;
+ }
+
+ .number-input {
+ max-width: 6em;
+ }
+ }
+}
diff --git a/src/components/admin_modal/tabs/general_tab.js b/src/components/admin_modal/tabs/general_tab.js
new file mode 100644
index 00000000..8c166f19
--- /dev/null
+++ b/src/components/admin_modal/tabs/general_tab.js
@@ -0,0 +1,33 @@
+import BooleanSetting from '../settings_modal/helpers/boolean_setting.vue'
+import ChoiceSetting from '../settings_modal/helpers/choice_setting.vue'
+import IntegerSetting from '../settings_modal/helpers/integer_setting.vue'
+
+import { library } from '@fortawesome/fontawesome-svg-core'
+import {
+ faGlobe
+} from '@fortawesome/free-solid-svg-icons'
+
+library.add(
+ faGlobe
+)
+
+const GeneralTab = {
+ components: {
+ BooleanSetting,
+ ChoiceSetting,
+ IntegerSetting,
+ },
+ computed: {
+ mergedConfig () {
+ console.log(this.$store.state)
+ return this.$store.state
+ }
+ },
+ methods: {
+ changeDefaultScope (value) {
+ this.$store.dispatch('setProfileOption', { name: 'defaultScope', value })
+ }
+ }
+}
+
+export default GeneralTab
diff --git a/src/components/desktop_nav/desktop_nav.js b/src/components/desktop_nav/desktop_nav.js
index 745b1a81..f6a2e294 100644
--- a/src/components/desktop_nav/desktop_nav.js
+++ b/src/components/desktop_nav/desktop_nav.js
@@ -107,7 +107,10 @@ export default {
this.searchBarHidden = hidden
},
openSettingsModal () {
- this.$store.dispatch('openSettingsModal')
+ this.$store.dispatch('openSettingsModal', 'user')
+ },
+ openAdminModal () {
+ this.$store.dispatch('openSettingsModal', 'admin')
}
}
}
diff --git a/src/components/desktop_nav/desktop_nav.vue b/src/components/desktop_nav/desktop_nav.vue
index dc8bbfd3..49382f8e 100644
--- a/src/components/desktop_nav/desktop_nav.vue
+++ b/src/components/desktop_nav/desktop_nav.vue
@@ -48,20 +48,19 @@
icon="cog"
/>
-
-
+
+
+
+
{{ $t('admin_dash.instance') }}
+
+
+
+ NAME
+
+
+
+
+ DESCRIPTION
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
index a766e6dc..9195d3e9 100644
--- a/src/components/settings_modal/helpers/setting.js
+++ b/src/components/settings_modal/helpers/setting.js
@@ -42,6 +42,8 @@ export default {
switch (this.source) {
case 'profile':
return this.$store.state.profileConfig
+ case 'admin':
+ return this.$store.state.adminSettings.config
default:
return this.$store.getters.mergedConfig
}
@@ -50,6 +52,8 @@ export default {
switch (this.source) {
case 'profile':
return (k, v) => this.$store.dispatch('setProfileOption', { name: k, value: v })
+ case 'admin':
+ return (k, v) => console.log(this.path, k, v)
default:
return (k, v) => this.$store.dispatch('setOption', { name: k, value: v })
}
@@ -66,7 +70,15 @@ export default {
return this.source === 'profile'
},
isChanged () {
- return !this.source === 'default' && this.state !== this.defaultState
+ switch (this.source) {
+ case 'profile':
+ return false
+ case 'admin':
+ console.log(this.$store.state.adminSettings.modifiedPaths)
+ return this.$store.state.adminSettings.modifiedPaths.has(this.path)
+ default:
+ return this.state !== this.defaultState
+ }
},
matchesExpertLevel () {
return (this.expert || 0) <= this.$store.state.config.expertLevel > 0
diff --git a/src/components/settings_modal/helpers/string_setting.js b/src/components/settings_modal/helpers/string_setting.js
new file mode 100644
index 00000000..64f8772d
--- /dev/null
+++ b/src/components/settings_modal/helpers/string_setting.js
@@ -0,0 +1,9 @@
+import ModifiedIndicator from './modified_indicator.vue'
+import Setting from './setting.js'
+
+export default {
+ components: {
+ ModifiedIndicator
+ },
+ ...Setting
+}
diff --git a/src/components/settings_modal/helpers/string_setting.vue b/src/components/settings_modal/helpers/string_setting.vue
new file mode 100644
index 00000000..e4bd2de9
--- /dev/null
+++ b/src/components/settings_modal/helpers/string_setting.vue
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ {{ ' ' }}
+
+
+
+
+
diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js
index 0a72dca1..e033d999 100644
--- a/src/components/settings_modal/settings_modal.js
+++ b/src/components/settings_modal/settings_modal.js
@@ -53,8 +53,16 @@ const SettingsModal = {
Modal,
Popover,
Checkbox,
- SettingsModalContent: getResettableAsyncComponent(
- () => import('./settings_modal_content.vue'),
+ SettingsModalUserContent: getResettableAsyncComponent(
+ () => import('./settings_modal_user_content.vue'),
+ {
+ loadingComponent: PanelLoading,
+ errorComponent: AsyncComponentError,
+ delay: 0
+ }
+ ),
+ SettingsModalAdminContent: getResettableAsyncComponent(
+ () => import('./settings_modal_admin_content.vue'),
{
loadingComponent: PanelLoading,
errorComponent: AsyncComponentError,
@@ -156,8 +164,14 @@ const SettingsModal = {
modalActivated () {
return this.$store.state.interface.settingsModalState !== 'hidden'
},
- modalOpenedOnce () {
- return this.$store.state.interface.settingsModalLoaded
+ modalMode () {
+ return this.$store.state.interface.settingsModalMode
+ },
+ modalOpenedOnceUser () {
+ return this.$store.state.interface.settingsModalLoadedUser
+ },
+ modalOpenedOnceAdmin () {
+ return this.$store.state.interface.settingsModalLoadedAdmin
},
modalPeeked () {
return this.$store.state.interface.settingsModalState === 'minimized'
@@ -167,7 +181,6 @@ const SettingsModal = {
return this.$store.state.config.expertLevel > 0
},
set (value) {
- console.log(value)
this.$store.dispatch('setOption', { name: 'expertLevel', value: value ? 1 : 0 })
}
}
diff --git a/src/components/settings_modal/settings_modal.vue b/src/components/settings_modal/settings_modal.vue
index 7b457371..73e1524a 100644
--- a/src/components/settings_modal/settings_modal.vue
+++ b/src/components/settings_modal/settings_modal.vue
@@ -42,7 +42,8 @@
-
+
+
diff --git a/src/components/settings_modal/helpers/choice_setting.js b/src/components/settings_modal/helpers/choice_setting.js
index a3c3bf44..3ff81bc9 100644
--- a/src/components/settings_modal/helpers/choice_setting.js
+++ b/src/components/settings_modal/helpers/choice_setting.js
@@ -11,7 +11,32 @@ export default {
...Setting.props,
options: {
type: Array,
- required: true
+ required: false
+ },
+ optionLabelMap: {
+ type: Object,
+ required: false,
+ default: {}
+ }
+ },
+ computed: {
+ ...Setting.computed,
+ realOptions () {
+ if (this.source === 'admin') {
+ console.log(this.backendDescriptionSuggestions)
+ return this.backendDescriptionSuggestions.map(x => ({
+ key: x,
+ value: x,
+ label: this.optionLabelMap[x] || x
+ }))
+ }
+ return this.options
+ }
+ },
+ methods: {
+ ...Setting.methods,
+ getValue (e) {
+ return e
}
}
}
diff --git a/src/components/settings_modal/helpers/choice_setting.vue b/src/components/settings_modal/helpers/choice_setting.vue
index 4c4cdefe..55f9a62c 100644
--- a/src/components/settings_modal/helpers/choice_setting.vue
+++ b/src/components/settings_modal/helpers/choice_setting.vue
@@ -3,15 +3,20 @@
v-if="matchesExpertLevel"
class="ChoiceSetting"
>
-
+
+ {{ backendDescriptionLabel }}
+
+
+
+
{{ ' ' }}
@@ -24,6 +29,13 @@
:onclick="reset"
/>
+
+
+ {{ backendDescriptionDescription + ' ' }}
+
diff --git a/src/components/settings_modal/helpers/number_setting.vue b/src/components/settings_modal/helpers/number_setting.vue
index 81335762..93a7a79a 100644
--- a/src/components/settings_modal/helpers/number_setting.vue
+++ b/src/components/settings_modal/helpers/number_setting.vue
@@ -4,7 +4,12 @@
class="NumberSetting"
>
-
+
+ {{ backendDescriptionLabel + ' ' }}
+
+
+
+
+
+
+
+ {{ backendDescriptionDescription + ' ' }}
+
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
index 8c7074a5..a6d35fb9 100644
--- a/src/components/settings_modal/helpers/setting.js
+++ b/src/components/settings_modal/helpers/setting.js
@@ -13,7 +13,7 @@ export default {
},
props: {
path: {
- type: String,
+ type: [String, Array],
required: true
},
disabled: {
@@ -21,7 +21,7 @@ export default {
default: false
},
parentPath: {
- type: String
+ type: [String, Array]
},
parentInvert: {
type: Boolean,
@@ -68,6 +68,9 @@ export default {
backendDescriptionDescription () {
return this.backendDescription?.description
},
+ backendDescriptionSuggestions () {
+ return this.backendDescription?.suggestions
+ },
shouldBeDisabled () {
const parentValue = this.parentPath !== undefined ? get(this.configSource, this.parentPath) : null
return this.disabled || (parentValue !== null ? (this.parentInvert ? parentValue : !parentValue) : false)
diff --git a/src/components/settings_modal/helpers/shared_computed_object.js b/src/components/settings_modal/helpers/shared_computed_object.js
index 912999ce..d02db542 100644
--- a/src/components/settings_modal/helpers/shared_computed_object.js
+++ b/src/components/settings_modal/helpers/shared_computed_object.js
@@ -7,6 +7,9 @@ const SharedComputedObject = () => ({
},
mergedConfig () {
return this.$store.getters.mergedConfig
+ },
+ adminConfig () {
+ return this.$store.state.adminSettings.config
}
})
diff --git a/src/modules/adminSettings.js b/src/modules/adminSettings.js
index 44a4d409..a84fadbf 100644
--- a/src/modules/adminSettings.js
+++ b/src/modules/adminSettings.js
@@ -29,7 +29,7 @@ const adminSettingsStorage = {
const config = state.config || {}
const modifiedPaths = state.modifiedPaths || new Set()
backendDbConfig.configs.forEach(c => {
- const path = c.group + '.' + c.key
+ const path = [c.group, c.key]
if (c.db) {
c.db.forEach(x => modifiedPaths.add(path + '.' + x))
}
@@ -44,16 +44,16 @@ const adminSettingsStorage = {
}
set(config, path, convert(c.value))
})
- console.log(config[':pleroma'][':welcome'])
+ console.log(config[':pleroma'])
commit('updateAdminSettings', { config, modifiedPaths })
},
setInstanceAdminDescriptions ({ state, commit, dispatch }, { backendDescriptions }) {
const convert = ({ children, description, label, key = '', group, suggestions }, path, acc) => {
- const newPath = group ? group + '.' + key : key
+ const newPath = group ? [group, key] : [key]
const obj = { description, label, suggestions }
if (Array.isArray(children)) {
children.forEach(c => {
- convert(c, '.' + newPath, obj)
+ convert(c, newPath, obj)
})
}
set(acc, newPath, obj)
@@ -61,12 +61,13 @@ const adminSettingsStorage = {
const descriptions = {}
backendDescriptions.forEach(d => convert(d, '', descriptions))
+ console.log(descriptions[':pleroma']['Pleroma.Captcha'])
commit('updateAdminDescriptions', { descriptions })
},
pushAdminSetting ({ rootState, state, commit, dispatch }, { path, value }) {
- const [group, key, ...rest] = path.split(/\./g)
+ const [group, key, ...rest] = Array.isArray(path) ? path : path.split(/\./g)
const clone = {} // not actually cloning the entire thing to avoid excessive writes
- set(clone, rest.join('.'), value)
+ set(clone, rest, value)
// TODO cleanup paths in modifiedPaths
const convert = (value) => {
--
cgit v1.2.3-70-g09d2
From 9a97e0d196c879e41dcb8bda8bd8128a039bacdc Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Tue, 21 Mar 2023 10:26:25 +0200
Subject: modal update, initial localization
---
.../settings_modal/admin_tabs/instance_tab.vue | 10 ++++----
.../settings_modal/admin_tabs/limits_tab.vue | 24 ++++++++++---------
src/components/settings_modal/settings_modal.vue | 15 +++++++++++-
.../settings_modal/settings_modal_admin_content.js | 4 ++--
.../settings_modal_admin_content.vue | 6 ++---
src/i18n/en.json | 27 ++++++++++++++++++++++
6 files changed, 64 insertions(+), 22 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index ff784287..411982cc 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -1,7 +1,7 @@
-
+
-
{{ $t('admin_dash.instance') }}
+
{{ $t('admin_dash.instance.instance') }}
-
{{ $t('admin_dash.registrations') }}
+
{{ $t('admin_dash.instance.registrations') }}
- {{ $t('admin_dash.captcha.header') }}
+ {{ $t('admin_dash.instance.captcha_header') }}
- {{ $t('admin_dash.kocaptcha') }}
+ {{ $t('admin_dash.instance.kocaptcha') }}
-
+
-
{{ $t('admin_dash.arbitrary_limits') }}
+
{{ $t('admin_dash.limits.arbitrary_limits') }}
{{ $t('admin_dash.limits.posts') }}
@@ -19,6 +19,7 @@
POST LIMIT (remote)
@@ -57,6 +58,15 @@
{{ $t('admin_dash.limits.users') }}
+
+
+ MAX PINNED POSTS
+
+
MAX ACCOUNT FIELDS (remote)
@@ -135,15 +146,6 @@
MAX BANNER SIZE KiB
-
-
- MAX PINNED POSTS
-
-
diff --git a/src/components/settings_modal/settings_modal.vue b/src/components/settings_modal/settings_modal.vue
index 73e1524a..303050e4 100644
--- a/src/components/settings_modal/settings_modal.vue
+++ b/src/components/settings_modal/settings_modal.vue
@@ -8,7 +8,7 @@
- {{ $t('settings.settings') }}
+ {{ modalMode === 'user' ? $t('settings.settings') : $t('admin_dash.window_title') }}
+
+
+
diff --git a/src/i18n/en.json b/src/i18n/en.json
index dd78d148..86ae7f06 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -845,8 +845,16 @@
"reset_all": "Reset all",
"commit_all": "Save all",
"tabs": {
+ "nodb": "No DB Config",
"instance": "Instance",
- "limits": "Limits"
+ "limits": "Limits",
+ "frontends": "Front-ends"
+ },
+ "nodb": {
+ "heading": "Database config is disabled",
+ "text": "You need to change backend config files so that {property} is set to {value}, see more in {documentation}.",
+ "documentation": "documentation",
+ "text2": "Most configuration options will be unavailable."
},
"captcha": {
"native": "Native",
diff --git a/src/modules/adminSettings.js b/src/modules/adminSettings.js
index 25fb8e50..fef73974 100644
--- a/src/modules/adminSettings.js
+++ b/src/modules/adminSettings.js
@@ -1,11 +1,13 @@
import { set, get, cloneDeep, differenceWith, isEqual, flatten } from 'lodash'
export const defaultState = {
+ loaded: false,
needsReboot: null,
config: null,
modifiedPaths: null,
descriptions: null,
- draft: null
+ draft: null,
+ dbConfigEnabled: null
}
export const newUserFlags = {
@@ -17,7 +19,13 @@ const adminSettingsStorage = {
...cloneDeep(defaultState)
},
mutations: {
+ setInstanceAdminNoDbConfig (state) {
+ state.loaded = false
+ state.dbConfigEnabled = false
+ },
updateAdminSettings (state, { config, modifiedPaths }) {
+ state.loaded = true
+ state.dbConfigEnabled = true
state.config = config
state.modifiedPaths = modifiedPaths
},
@@ -40,6 +48,26 @@ const adminSettingsStorage = {
}
},
actions: {
+ loadAdminStuff ({ state, rootState, dispatch, commit }) {
+ rootState.api.backendInteractor.fetchInstanceDBConfig()
+ .then(backendDbConfig => {
+ if (backendDbConfig.error) {
+ if (backendDbConfig.error.status === 400) {
+ backendDbConfig.error.json().then(errorJson => {
+ if (/configurable_from_database/.test(errorJson.error)) {
+ commit('setInstanceAdminNoDbConfig')
+ }
+ })
+ }
+ } else {
+ dispatch('setInstanceAdminSettings', { backendDbConfig })
+ }
+ })
+ if (state.descriptions === null) {
+ rootState.api.backendInteractor.fetchInstanceConfigDescriptions()
+ .then(backendDescriptions => this.$store.dispatch('setInstanceAdminDescriptions', { backendDescriptions }))
+ }
+ },
setInstanceAdminSettings ({ state, commit, dispatch }, { backendDbConfig }) {
const config = state.config || {}
const modifiedPaths = new Set()
diff --git a/src/modules/users.js b/src/modules/users.js
index 45cba334..a23f6d7d 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -564,12 +564,6 @@ const users = {
user.domainMutes = []
commit('setCurrentUser', user)
commit('setServerSideStorage', user)
- if (user.rights.admin) {
- store.rootState.api.backendInteractor.fetchInstanceDBConfig()
- .then(backendDbConfig => dispatch('setInstanceAdminSettings', { backendDbConfig }))
- store.rootState.api.backendInteractor.fetchInstanceConfigDescriptions()
- .then(backendDescriptions => dispatch('setInstanceAdminDescriptions', { backendDescriptions }))
- }
commit('addNewUsers', [user])
dispatch('fetchEmoji')
--
cgit v1.2.3-70-g09d2
From 7bb28bb23c61e2d648eecf5d59969d32631f78e8 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Wed, 29 Mar 2023 00:58:07 +0300
Subject: frontends tab initial implementation, now you can (re)install
frontends! yay!
---
src/App.scss | 22 ++++++-
.../settings_modal/admin_tabs/frontends_tab.js | 58 +++++++++++++++++
.../settings_modal/admin_tabs/frontends_tab.scss | 13 ++++
.../settings_modal/admin_tabs/frontends_tab.vue | 72 ++++++++++++++++++++++
src/components/settings_modal/settings_modal.scss | 1 -
.../settings_modal/settings_modal_admin_content.js | 8 +--
src/i18n/en.json | 8 +++
src/modules/adminSettings.js | 15 +++++
src/services/api/api.service.js | 42 ++++++++++++-
9 files changed, 229 insertions(+), 10 deletions(-)
create mode 100644 src/components/settings_modal/admin_tabs/frontends_tab.js
create mode 100644 src/components/settings_modal/admin_tabs/frontends_tab.scss
create mode 100644 src/components/settings_modal/admin_tabs/frontends_tab.vue
(limited to 'src/components/settings_modal')
diff --git a/src/App.scss b/src/App.scss
index 3f352e8d..149d640f 100644
--- a/src/App.scss
+++ b/src/App.scss
@@ -645,6 +645,19 @@ option {
}
}
+.cards-list {
+ display: grid;
+ grid-auto-flow: row dense;
+ grid-template-columns: 1fr 1fr;
+
+ li {
+ border: 1px solid var(--border);
+ border-radius: var(--inputRadius);
+ padding: 0.5em;
+ margin: 0.25em;
+ }
+}
+
.btn-block {
display: block;
width: 100%;
@@ -655,16 +668,19 @@ option {
display: inline-flex;
vertical-align: middle;
- button {
+ button,
+ .button-dropdown {
position: relative;
flex: 1 1 auto;
- &:not(:last-child) {
+ &:not(:last-child),
+ &:not(:last-child) .button-default {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
- &:not(:first-child) {
+ &:not(:first-child),
+ &:not(:first-child) .button-default {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.js b/src/components/settings_modal/admin_tabs/frontends_tab.js
new file mode 100644
index 00000000..a5d33cbe
--- /dev/null
+++ b/src/components/settings_modal/admin_tabs/frontends_tab.js
@@ -0,0 +1,58 @@
+import BooleanSetting from '../helpers/boolean_setting.vue'
+import ChoiceSetting from '../helpers/choice_setting.vue'
+import IntegerSetting from '../helpers/integer_setting.vue'
+import StringSetting from '../helpers/string_setting.vue'
+import GroupSetting from '../helpers/group_setting.vue'
+import Popover from 'src/components/popover/popover.vue'
+
+import SharedComputedObject from '../helpers/shared_computed_object.js'
+import { library } from '@fortawesome/fontawesome-svg-core'
+import {
+ faGlobe
+} from '@fortawesome/free-solid-svg-icons'
+
+library.add(
+ faGlobe
+)
+
+const FrontendsTab = {
+ provide () {
+ return {
+ defaultDraftMode: true,
+ defaultSource: 'admin'
+ }
+ },
+ components: {
+ BooleanSetting,
+ ChoiceSetting,
+ IntegerSetting,
+ StringSetting,
+ GroupSetting,
+ Popover
+ },
+ created () {
+ if (this.user.rights.admin) {
+ this.$store.dispatch('loadFrontendsStuff')
+ }
+ },
+ computed: {
+ frontends () {
+ return this.$store.state.adminSettings.frontends
+ },
+ ...SharedComputedObject()
+ },
+ methods: {
+ update (frontend, suggestRef) {
+ const ref = suggestRef || frontend.refs[0]
+ const { name } = frontend
+ const payload = { name, ref }
+
+ this.$store.state.api.backendInteractor.installFrontend({ payload })
+ .then((externalUser) => {
+ this.$store.dispatch('loadFrontendsStuff')
+ })
+ }
+ }
+}
+
+export default FrontendsTab
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.scss b/src/components/settings_modal/admin_tabs/frontends_tab.scss
new file mode 100644
index 00000000..1e1881ff
--- /dev/null
+++ b/src/components/settings_modal/admin_tabs/frontends_tab.scss
@@ -0,0 +1,13 @@
+.frontends-tab {
+ .cards-list {
+ padding: 0;
+ }
+
+ dd {
+ text-overflow: ellipsis;
+ word-wrap: nowrap;
+ white-space: nowrap;
+ overflow-x: hidden;
+ max-width: 80%;
+ }
+}
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.vue b/src/components/settings_modal/admin_tabs/frontends_tab.vue
new file mode 100644
index 00000000..48649dfb
--- /dev/null
+++ b/src/components/settings_modal/admin_tabs/frontends_tab.vue
@@ -0,0 +1,72 @@
+
+
+
+
{{ $t('admin_dash.tabs.frontends') }}
+
+
+ {{ frontend.name }}
+
+ {{ $t('admin_dash.frontend.repository') }}
+ {{ frontend.git }}
+ {{ $t('admin_dash.frontend.versions') }}
+ {{ frontend.refs }}
+ {{ $t('admin_dash.frontend.build_url') }}
+ {{ frontend.build_url }}
+
+
+
+
+ {{
+ frontend.installed
+ ? $t('admin_dash.frontend.reinstall')
+ : $t('admin_dash.frontend.install')
+ }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/settings_modal/settings_modal.scss b/src/components/settings_modal/settings_modal.scss
index 4cb506f9..98de736b 100644
--- a/src/components/settings_modal/settings_modal.scss
+++ b/src/components/settings_modal/settings_modal.scss
@@ -43,7 +43,6 @@
.btn {
min-height: 2em;
- min-width: 10em;
padding: 0 2em;
}
}
diff --git a/src/components/settings_modal/settings_modal_admin_content.js b/src/components/settings_modal/settings_modal_admin_content.js
index 1c239e59..b7c0de57 100644
--- a/src/components/settings_modal/settings_modal_admin_content.js
+++ b/src/components/settings_modal/settings_modal_admin_content.js
@@ -1,9 +1,8 @@
import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
-import DataImportExportTab from './tabs/data_import_export_tab.vue'
-import MutesAndBlocksTab from './tabs/mutes_and_blocks_tab.vue'
import InstanceTab from './admin_tabs/instance_tab.vue'
import LimitsTab from './admin_tabs/limits_tab.vue'
+import FrontendsTab from './admin_tabs/frontends_tab.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
@@ -32,10 +31,9 @@ const SettingsModalAdminContent = {
components: {
TabSwitcher,
- DataImportExportTab,
- MutesAndBlocksTab,
InstanceTab,
- LimitsTab
+ LimitsTab,
+ FrontendsTab
},
computed: {
user () {
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 86ae7f06..ede5d494 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -873,6 +873,14 @@
"users": "User profile limits",
"profile_fields": "Profile fields limits",
"user_uploads": "Profile media limits"
+ },
+ "frontend": {
+ "repository": "Repository link",
+ "versions": "Available versions",
+ "build_url": "Build URL",
+ "reinstall": "Reinstall",
+ "install": "Install",
+ "install_version": "Install version {version}"
}
},
"time": {
diff --git a/src/modules/adminSettings.js b/src/modules/adminSettings.js
index b8265949..cad9c0ca 100644
--- a/src/modules/adminSettings.js
+++ b/src/modules/adminSettings.js
@@ -1,6 +1,7 @@
import { set, get, cloneDeep, differenceWith, isEqual, flatten } from 'lodash'
export const defaultState = {
+ frontends: [],
loaded: false,
needsReboot: null,
config: null,
@@ -23,6 +24,16 @@ const adminSettingsStorage = {
state.loaded = false
state.dbConfigEnabled = false
},
+ setAvailableFrontends (state, { frontends }) {
+ state.frontends = frontends.map(f => {
+ if (f.name === 'pleroma-fe') {
+ f.refs = ['master', 'develop']
+ } else {
+ f.refs = [f.ref]
+ }
+ return f
+ })
+ },
updateAdminSettings (state, { config, modifiedPaths }) {
state.loaded = true
state.dbConfigEnabled = true
@@ -48,6 +59,10 @@ const adminSettingsStorage = {
}
},
actions: {
+ loadFrontendsStuff ({ state, rootState, dispatch, commit }) {
+ rootState.api.backendInteractor.fetchAvailableFrontends()
+ .then(frontends => commit('setAvailableFrontends', { frontends }))
+ },
loadAdminStuff ({ state, rootState, dispatch, commit }) {
rootState.api.backendInteractor.fetchInstanceDBConfig()
.then(backendDbConfig => {
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 073f40a3..56e7de71 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -110,6 +110,8 @@ const PLEROMA_DELETE_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcemen
const PLEROMA_ADMIN_CONFIG_URL = '/api/pleroma/admin/config'
const PLEROMA_ADMIN_DESCRIPTIONS_URL = '/api/pleroma/admin/config/descriptions'
+const PLEROMA_ADMIN_FRONTENDS_URL = '/api/pleroma/admin/frontends'
+const PLEROMA_ADMIN_FRONTENDS_INSTALL_URL = '/api/pleroma/admin/frontends/install'
const oldfetch = window.fetch
@@ -1693,6 +1695,21 @@ const fetchInstanceConfigDescriptions = ({ credentials }) => {
})
}
+const fetchAvailableFrontends = ({ credentials }) => {
+ return fetch(PLEROMA_ADMIN_FRONTENDS_URL, {
+ headers: authHeaders(credentials)
+ })
+ .then((response) => {
+ if (response.ok) {
+ return response.json()
+ } else {
+ return {
+ error: response
+ }
+ }
+ })
+}
+
const pushInstanceDBConfig = ({ credentials, payload }) => {
return fetch(PLEROMA_ADMIN_CONFIG_URL, {
headers: {
@@ -1714,6 +1731,27 @@ const pushInstanceDBConfig = ({ credentials, payload }) => {
})
}
+const installFrontend = ({ credentials, payload }) => {
+ return fetch(PLEROMA_ADMIN_FRONTENDS_INSTALL_URL, {
+ headers: {
+ Accept: 'application/json',
+ 'Content-Type': 'application/json',
+ ...authHeaders(credentials)
+ },
+ method: 'POST',
+ body: JSON.stringify(payload)
+ })
+ .then((response) => {
+ if (response.ok) {
+ return response.json()
+ } else {
+ return {
+ error: response
+ }
+ }
+ })
+}
+
const apiService = {
verifyCredentials,
fetchTimeline,
@@ -1830,7 +1868,9 @@ const apiService = {
adminFetchAnnouncements,
fetchInstanceDBConfig,
fetchInstanceConfigDescriptions,
- pushInstanceDBConfig
+ fetchAvailableFrontends,
+ pushInstanceDBConfig,
+ installFrontend
}
export default apiService
--
cgit v1.2.3-70-g09d2
From ac75d051b720da2c47393de6b35663afe50d37cc Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Wed, 29 Mar 2023 23:26:57 +0300
Subject: better frontends tab, now you can set default frontend
---
src/App.scss | 1 +
.../settings_modal/admin_tabs/frontends_tab.js | 6 +
.../settings_modal/admin_tabs/frontends_tab.scss | 2 +-
.../settings_modal/admin_tabs/frontends_tab.vue | 204 +++++++++++++++------
.../settings_modal/helpers/group_setting.js | 1 -
src/components/settings_modal/helpers/setting.js | 4 +-
.../helpers/shared_computed_object.js | 3 +
src/components/settings_modal/settings_modal.scss | 3 +
.../settings_modal/settings_modal_admin_content.js | 3 +
.../settings_modal_admin_content.vue | 1 +
src/i18n/en.json | 11 +-
11 files changed, 177 insertions(+), 62 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/App.scss b/src/App.scss
index 149d640f..ef68ac50 100644
--- a/src/App.scss
+++ b/src/App.scss
@@ -646,6 +646,7 @@ option {
}
.cards-list {
+ list-style: none;
display: grid;
grid-auto-flow: row dense;
grid-template-columns: 1fr 1fr;
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.js b/src/components/settings_modal/admin_tabs/frontends_tab.js
index a5d33cbe..a2c27c2a 100644
--- a/src/components/settings_modal/admin_tabs/frontends_tab.js
+++ b/src/components/settings_modal/admin_tabs/frontends_tab.js
@@ -51,6 +51,12 @@ const FrontendsTab = {
.then((externalUser) => {
this.$store.dispatch('loadFrontendsStuff')
})
+ },
+ setDefault (frontend, suggestRef) {
+ const ref = suggestRef || frontend.refs[0]
+ const { name } = frontend
+
+ this.$store.commit('updateAdminDraft', { path: [':pleroma', ':frontends', ':primary'], value: { name, ref } })
}
}
}
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.scss b/src/components/settings_modal/admin_tabs/frontends_tab.scss
index 1e1881ff..e3e04bc6 100644
--- a/src/components/settings_modal/admin_tabs/frontends_tab.scss
+++ b/src/components/settings_modal/admin_tabs/frontends_tab.scss
@@ -8,6 +8,6 @@
word-wrap: nowrap;
white-space: nowrap;
overflow-x: hidden;
- max-width: 80%;
+ max-width: 10em;
}
}
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.vue b/src/components/settings_modal/admin_tabs/frontends_tab.vue
index 48649dfb..71bbfa69 100644
--- a/src/components/settings_modal/admin_tabs/frontends_tab.vue
+++ b/src/components/settings_modal/admin_tabs/frontends_tab.vue
@@ -2,67 +2,157 @@
{{ $t('admin_dash.tabs.frontends') }}
-
-
- {{ frontend.name }}
-
- {{ $t('admin_dash.frontend.repository') }}
- {{ frontend.git }}
- {{ $t('admin_dash.frontend.versions') }}
- {{ frontend.refs }}
- {{ $t('admin_dash.frontend.build_url') }}
- {{ frontend.build_url }}
-
-
-
-
- {{
- frontend.installed
- ? $t('admin_dash.frontend.reinstall')
- : $t('admin_dash.frontend.install')
- }}
-
- {{ $t('admin_dash.frontend.wip_notice') }}
+
+
+
{{ $t('admin_dash.frontend.available_frontends') }}
+
+
+ {{ frontend.name }}
+ {{ ' ' }}
+
+
+
-
-
-
-
+
+
+
+
+
+ {{
+ $t('admin_dash.frontend.set_default')
+ }}
+
+ {{ ' ' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/settings_modal/helpers/group_setting.js b/src/components/settings_modal/helpers/group_setting.js
index 12a49000..23a2a202 100644
--- a/src/components/settings_modal/helpers/group_setting.js
+++ b/src/components/settings_modal/helpers/group_setting.js
@@ -7,7 +7,6 @@ export default {
computed: {
...Setting.computed,
isDirty () {
- console.log(this.state, this.draft)
return !isEqual(this.state, this.draft)
}
}
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
index d2e1a6f4..4f0be448 100644
--- a/src/components/settings_modal/helpers/setting.js
+++ b/src/components/settings_modal/helpers/setting.js
@@ -61,7 +61,7 @@ export default {
// TODO allow passing shared draft object?
get () {
if (this.realSource === 'admin') {
- return get(this.$store.state.adminSettings.draft, this.path)
+ return get(this.$store.state.adminSettings.draft, this.canonPath)
} else {
return this.localDraft
}
@@ -75,7 +75,7 @@ export default {
}
},
state () {
- const value = get(this.configSource, this.path)
+ const value = get(this.configSource, this.canonPath)
if (value === undefined) {
return this.defaultState
} else {
diff --git a/src/components/settings_modal/helpers/shared_computed_object.js b/src/components/settings_modal/helpers/shared_computed_object.js
index d02db542..bb3d36ac 100644
--- a/src/components/settings_modal/helpers/shared_computed_object.js
+++ b/src/components/settings_modal/helpers/shared_computed_object.js
@@ -10,6 +10,9 @@ const SharedComputedObject = () => ({
},
adminConfig () {
return this.$store.state.adminSettings.config
+ },
+ adminDraft () {
+ return this.$store.state.adminSettings.draft
}
})
diff --git a/src/components/settings_modal/settings_modal.scss b/src/components/settings_modal/settings_modal.scss
index 98de736b..49ef83e0 100644
--- a/src/components/settings_modal/settings_modal.scss
+++ b/src/components/settings_modal/settings_modal.scss
@@ -43,6 +43,9 @@
.btn {
min-height: 2em;
+ }
+
+ .btn:not(.dropdown-button) {
padding: 0 2em;
}
}
diff --git a/src/components/settings_modal/settings_modal_admin_content.js b/src/components/settings_modal/settings_modal_admin_content.js
index b7c0de57..f94721ec 100644
--- a/src/components/settings_modal/settings_modal_admin_content.js
+++ b/src/components/settings_modal/settings_modal_admin_content.js
@@ -51,6 +51,9 @@ const SettingsModalAdminContent = {
adminDbLoaded () {
return this.$store.state.adminSettings.loaded
},
+ adminDescriptionsLoaded () {
+ return this.$store.state.adminSettings.descriptions !== null
+ },
noDb () {
return this.$store.state.adminSettings.dbConfigEnabled === false
}
diff --git a/src/components/settings_modal/settings_modal_admin_content.vue b/src/components/settings_modal/settings_modal_admin_content.vue
index ae670a90..a7a2ac9a 100644
--- a/src/components/settings_modal/settings_modal_admin_content.vue
+++ b/src/components/settings_modal/settings_modal_admin_content.vue
@@ -1,5 +1,6 @@
Date: Wed, 29 Mar 2023 23:33:50 +0300
Subject: use draft state instead of live state in that one place
---
src/components/settings_modal/admin_tabs/instance_tab.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index 9291ddf8..fc41af65 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -197,7 +197,7 @@
{{ $t('admin_dash.instance.kocaptcha') }}
--
cgit v1.2.3-70-g09d2
From 4c158e636bd7ae9ec03a202e54aa681e66645a78 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Wed, 12 Apr 2023 23:58:21 +0300
Subject: more i18n stuff, added missing labels and such
---
.../settings_modal/admin_tabs/instance_tab.vue | 12 +++++++
.../settings_modal/helpers/boolean_setting.vue | 2 +-
.../settings_modal/helpers/choice_setting.vue | 2 +-
.../settings_modal/helpers/number_setting.vue | 2 +-
src/components/settings_modal/helpers/setting.js | 41 ++++++++++++++++++++--
.../settings_modal/helpers/string_setting.vue | 2 +-
src/i18n/en.json | 23 +++++++++++-
7 files changed, 77 insertions(+), 7 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index fc41af65..40e33495 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -58,6 +58,8 @@
LOCAL TIMELINES
@@ -66,6 +68,8 @@
FED TIMELINES
@@ -82,6 +86,8 @@
LOCAL PROFILES
@@ -90,6 +96,8 @@
FED PROFILES
@@ -106,6 +114,8 @@
LOCAL STATUSES
@@ -114,6 +124,8 @@
FED STATUSES
diff --git a/src/components/settings_modal/helpers/boolean_setting.vue b/src/components/settings_modal/helpers/boolean_setting.vue
index 6307d526..3089c3b3 100644
--- a/src/components/settings_modal/helpers/boolean_setting.vue
+++ b/src/components/settings_modal/helpers/boolean_setting.vue
@@ -14,7 +14,7 @@
class="label"
:class="{ 'faint': shouldBeDisabled }"
>
-
+
{{ backendDescriptionLabel }}
diff --git a/src/components/settings_modal/helpers/choice_setting.vue b/src/components/settings_modal/helpers/choice_setting.vue
index 8713acf5..114e9b7d 100644
--- a/src/components/settings_modal/helpers/choice_setting.vue
+++ b/src/components/settings_modal/helpers/choice_setting.vue
@@ -3,7 +3,7 @@
v-if="matchesExpertLevel"
class="ChoiceSetting"
>
-
+
{{ backendDescriptionLabel }}
diff --git a/src/components/settings_modal/helpers/number_setting.vue b/src/components/settings_modal/helpers/number_setting.vue
index 2b90c336..ce168570 100644
--- a/src/components/settings_modal/helpers/number_setting.vue
+++ b/src/components/settings_modal/helpers/number_setting.vue
@@ -4,7 +4,7 @@
class="NumberSetting"
>
-
+
{{ backendDescriptionLabel + ' ' }}
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
index 4f0be448..fec1b947 100644
--- a/src/components/settings_modal/helpers/setting.js
+++ b/src/components/settings_modal/helpers/setting.js
@@ -33,6 +33,18 @@ export default {
type: String,
default: undefined
},
+ hideDescription: {
+ type: Boolean
+ },
+ swapDescriptionAndLabel: {
+ type: Boolean
+ },
+ overrideBackendDescription: {
+ type: Boolean
+ },
+ overrideBackendDescriptionLabel: {
+ type: Boolean
+ },
draftMode: {
type: Boolean,
default: undefined
@@ -95,10 +107,35 @@ export default {
return get(this.$store.state.adminSettings.descriptions, this.path)
},
backendDescriptionLabel () {
- return this.backendDescription?.label
+ if (this.realSource !== 'admin') return ''
+ if (!this.backendDescription || this.overrideBackendDescriptionLabel) {
+ return this.$t([
+ 'admin_dash',
+ 'temp_overrides',
+ ...this.canonPath.map(p => p.replace(/\./g, '_DOT_')),
+ 'label'
+ ].join('.'))
+ } else {
+ return this.swapDescriptionAndLabel
+ ? this.backendDescription?.description
+ : this.backendDescription?.label
+ }
},
backendDescriptionDescription () {
- return this.backendDescription?.description
+ if (this.realSource !== 'admin') return ''
+ if (this.hideDescription) return null
+ if (!this.backendDescription || this.overrideBackendDescription) {
+ return this.$t([
+ 'admin_dash',
+ 'temp_overrides',
+ ...this.canonPath.map(p => p.replace(/\./g, '_DOT_')),
+ 'description'
+ ].join('.'))
+ } else {
+ return this.swapDescriptionAndLabel
+ ? this.backendDescription?.label
+ : this.backendDescription?.description
+ }
},
backendDescriptionSuggestions () {
return this.backendDescription?.suggestions
diff --git a/src/components/settings_modal/helpers/string_setting.vue b/src/components/settings_modal/helpers/string_setting.vue
index 5ee75a84..7e70b82f 100644
--- a/src/components/settings_modal/helpers/string_setting.vue
+++ b/src/components/settings_modal/helpers/string_setting.vue
@@ -4,7 +4,7 @@
class="StringSetting"
>
-
+
{{ backendDescriptionLabel + ' ' }}
diff --git a/src/i18n/en.json b/src/i18n/en.json
index f4c2df3e..082ad826 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -864,7 +864,14 @@
"instance": "Instance information",
"registrations": "User sign-ups",
"captcha_header": "CAPTCHA",
- "kocaptcha": "KoCaptcha settings"
+ "kocaptcha": "KoCaptcha settings",
+ "access": "Instance access",
+ "restrict": {
+ "header": "Restrict access",
+ "timelines": "Timelines access",
+ "profiles": "User profiles access",
+ "activities": "Statues/activities access"
+ }
},
"limits": {
"arbitrary_limits": "Arbitrary limits",
@@ -890,6 +897,20 @@
"default_frontend_tip": "Default front-end will be shown to all users. Currently there's no way to for a user to select personal front-end. If you switch away from PleromaFE you'll most likely have to use old and buggy AdminFE to do instance configuration until we replace it.",
"default_frontend_tip2": "WIP: Since Pleroma backend doesn't properly list all installed frontends you'll have to enter name and reference manually. List below provides shortcuts to fill the values.",
"available_frontends": "Available for install"
+ },
+ "temp_overrides": {
+ ":pleroma": {
+ ":instance": {
+ ":description_limit": {
+ "label": "Limit",
+ "description": "Character limit for attachment descriptions"
+ },
+ ":background_image": {
+ "label": "Background image",
+ "description": "Background image (primarily used by PleromaFE)"
+ }
+ }
+ }
}
},
"time": {
--
cgit v1.2.3-70-g09d2
From d8ed541d12382ec58ea1ab75acb1ca153e22f2e4 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Thu, 13 Apr 2023 00:02:35 +0300
Subject: reordered registrations section to be above access since it's more
likely to be used more often
---
.../settings_modal/admin_tabs/instance_tab.vue | 170 ++++++++++-----------
1 file changed, 85 insertions(+), 85 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index 40e33495..535e4132 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -35,6 +35,91 @@
+
+
{{ $t('admin_dash.instance.registrations') }}
+
+
+
+ REGISTRATIONS OPEN
+
+
+
+
+ INVITES ENABLED
+
+
+
+
+
+
+ BDEY REQUIRED
+
+
+
+
+ BDEY age of consent
+
+
+
+
+
+
+ ACTIVATION REQUIRED
+
+
+
+
+ APPROVAL REQUIRED
+
+
+
+ {{ $t('admin_dash.instance.captcha_header') }}
+
+
+
+ CAPTCHA
+
+
+
+
+ CAPTCHA TYPE
+
+
+ VALID
+
+
+
+
+ {{ $t('admin_dash.instance.kocaptcha') }}
+
+
+ cockAPTCHA ENDPOINT
+
+
+
+
+
+
{{ $t('admin_dash.instance.access') }}
-
-
{{ $t('admin_dash.instance.registrations') }}
-
-
-
- REGISTRATIONS OPEN
-
-
-
-
- INVITES ENABLED
-
-
-
-
-
-
- BDEY REQUIRED
-
-
-
-
- BDEY age of consent
-
-
-
-
-
-
- ACTIVATION REQUIRED
-
-
-
-
- APPROVAL REQUIRED
-
-
-
- {{ $t('admin_dash.instance.captcha_header') }}
-
-
-
- CAPTCHA
-
-
-
-
- CAPTCHA TYPE
-
-
- VALID
-
-
-
-
- {{ $t('admin_dash.instance.kocaptcha') }}
-
-
- cockAPTCHA ENDPOINT
-
-
-
-
-
-
--
cgit v1.2.3-70-g09d2
From 9aaa8a86f52bc97838c768a8859919a3ad6fd54f Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Thu, 13 Apr 2023 01:11:20 +0300
Subject: initial implementation of attachmentsetting
---
.../settings_modal/admin_tabs/instance_tab.js | 2 +
.../settings_modal/admin_tabs/instance_tab.vue | 8 +--
.../settings_modal/helpers/attachment_setting.js | 42 +++++++++++++
.../settings_modal/helpers/attachment_setting.vue | 70 ++++++++++++++++++++++
.../settings_modal/helpers/string_setting.vue | 1 -
src/services/file_type/file_type.service.js | 18 +++++-
6 files changed, 134 insertions(+), 7 deletions(-)
create mode 100644 src/components/settings_modal/helpers/attachment_setting.js
create mode 100644 src/components/settings_modal/helpers/attachment_setting.vue
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.js b/src/components/settings_modal/admin_tabs/instance_tab.js
index f702afcf..b07bafe8 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.js
+++ b/src/components/settings_modal/admin_tabs/instance_tab.js
@@ -3,6 +3,7 @@ import ChoiceSetting from '../helpers/choice_setting.vue'
import IntegerSetting from '../helpers/integer_setting.vue'
import StringSetting from '../helpers/string_setting.vue'
import GroupSetting from '../helpers/group_setting.vue'
+import AttachmentSetting from '../helpers/attachment_setting.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js'
import { library } from '@fortawesome/fontawesome-svg-core'
@@ -26,6 +27,7 @@ const InstanceTab = {
ChoiceSetting,
IntegerSetting,
StringSetting,
+ AttachmentSetting,
GroupSetting
},
computed: {
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index 535e4132..e519e135 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -24,14 +24,14 @@
-
+
INSTANCE THUMBNAIL
-
+
-
+
BACKGROUND IMAGE
-
+
diff --git a/src/components/settings_modal/helpers/attachment_setting.js b/src/components/settings_modal/helpers/attachment_setting.js
new file mode 100644
index 00000000..a0a12ead
--- /dev/null
+++ b/src/components/settings_modal/helpers/attachment_setting.js
@@ -0,0 +1,42 @@
+import Setting from './setting.js'
+import { fileTypeExt } from 'src/services/file_type/file_type.service.js'
+import MediaUpload from 'src/components/media_upload/media_upload.vue'
+import Attachment from 'src/components/attachment/attachment.vue'
+
+export default {
+ ...Setting,
+ props: {
+ ...Setting.props,
+ type: {
+ type: Array,
+ required: false,
+ default: []
+ }
+ },
+ components: {
+ ...Setting.components,
+ MediaUpload,
+ Attachment
+ },
+ computed: {
+ ...Setting.computed,
+ attachment () {
+ const path = this.realDraftMode ? this.draft : this.state
+ const url = path.includes('://') ? path : this.$store.state.instance.server + path
+ return {
+ mimetype: fileTypeExt(url),
+ url
+ }
+ }
+ },
+ methods: {
+ ...Setting.methods,
+ setMediaFile (fileInfo) {
+ if (this.realDraftMode) {
+ this.draft = fileInfo.url
+ } else {
+ this.configSink(this.path, fileInfo.url)
+ }
+ }
+ }
+}
diff --git a/src/components/settings_modal/helpers/attachment_setting.vue b/src/components/settings_modal/helpers/attachment_setting.vue
new file mode 100644
index 00000000..3a933511
--- /dev/null
+++ b/src/components/settings_modal/helpers/attachment_setting.vue
@@ -0,0 +1,70 @@
+
+
+
+
+ {{ backendDescriptionLabel + ' ' }}
+
+
+
+
+
+
+
+ {{ backendDescriptionDescription + ' ' }}
+
+
+
+
+
+
+
+
+
diff --git a/src/components/settings_modal/helpers/string_setting.vue b/src/components/settings_modal/helpers/string_setting.vue
index 7e70b82f..84d0a9d6 100644
--- a/src/components/settings_modal/helpers/string_setting.vue
+++ b/src/components/settings_modal/helpers/string_setting.vue
@@ -14,7 +14,6 @@
{
+export const fileType = mimetype => {
if (mimetype.match(/flash/)) {
return 'flash'
}
@@ -25,11 +25,25 @@ const fileType = mimetype => {
return 'unknown'
}
-const fileMatchesSomeType = (types, file) =>
+export const fileTypeExt = url => {
+ if (url.match(/\.(png|jpe?g|gif|webp|avif)$/)) {
+ return 'image'
+ }
+ if (url.match(/\.(ogv|mp4|webm|mov)$/)) {
+ return 'video'
+ }
+ if (url.match(/\.(it|s3m|mod|umx|mp3|aac|m4a|flac|alac|ogg|oga|opus|wav|ape|midi?)$/)) {
+ return 'audio'
+ }
+ return 'unknown'
+}
+
+export const fileMatchesSomeType = (types, file) =>
types.some(type => fileType(file.mimetype) === type)
const fileTypeService = {
fileType,
+ fileTypeExt,
fileMatchesSomeType
}
--
cgit v1.2.3-70-g09d2
From e0fbeee88edb29f04a3260560d10d1a812f84029 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Mon, 24 Apr 2023 21:57:31 +0300
Subject: finish up attachment setting (right now only for admin section only)
---
src/components/media_upload/media_upload.js | 18 ++++++--
src/components/media_upload/media_upload.vue | 22 ++++++---
.../settings_modal/helpers/attachment_setting.js | 7 +--
.../settings_modal/helpers/attachment_setting.vue | 53 +++++++++++++++-------
src/i18n/en.json | 2 +
5 files changed, 73 insertions(+), 29 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/media_upload/media_upload.js b/src/components/media_upload/media_upload.js
index cfd42d4c..8c9e5f71 100644
--- a/src/components/media_upload/media_upload.js
+++ b/src/components/media_upload/media_upload.js
@@ -23,6 +23,11 @@ const mediaUpload = {
}
},
methods: {
+ onClick () {
+ if (this.uploadReady) {
+ this.$refs.input.click()
+ }
+ },
uploadFile (file) {
const self = this
const store = this.$store
@@ -69,10 +74,15 @@ const mediaUpload = {
this.multiUpload(target.files)
}
},
- props: [
- 'dropFiles',
- 'disabled'
- ],
+ props: {
+ dropFiles: Object,
+ disabled: Boolean,
+ normalButton: Boolean,
+ acceptTypes: {
+ type: String,
+ default: '*/*'
+ }
+ },
watch: {
dropFiles: function (fileInfos) {
if (!this.uploading) {
diff --git a/src/components/media_upload/media_upload.vue b/src/components/media_upload/media_upload.vue
index 2799495b..c761b94f 100644
--- a/src/components/media_upload/media_upload.vue
+++ b/src/components/media_upload/media_upload.vue
@@ -1,8 +1,10 @@
-
+
+ {{ ' ' }}
+ {{ uploading ? $t('general.loading') : $t('tool_tip.media_upload') }}
+
-
+
@@ -32,10 +40,12 @@
@import "../../variables";
.media-upload {
- cursor: pointer; // We use for interactivity... i wonder if it's fine
-
.hidden-input-file {
display: none;
}
}
-
+
+label.media-upload {
+ cursor: pointer; // We use for interactivity... i wonder if it's fine
+}
+
diff --git a/src/components/settings_modal/helpers/attachment_setting.js b/src/components/settings_modal/helpers/attachment_setting.js
index a0a12ead..ac5c6f86 100644
--- a/src/components/settings_modal/helpers/attachment_setting.js
+++ b/src/components/settings_modal/helpers/attachment_setting.js
@@ -7,10 +7,10 @@ export default {
...Setting,
props: {
...Setting.props,
- type: {
- type: Array,
+ acceptTypes: {
+ type: String,
required: false,
- default: []
+ default: 'image/*'
}
},
components: {
@@ -22,6 +22,7 @@ export default {
...Setting.computed,
attachment () {
const path = this.realDraftMode ? this.draft : this.state
+ // The "server" part is primarily for local dev, but could be useful for alt-domain or multiuser usage.
const url = path.includes('://') ? path : this.$store.state.instance.server + path
return {
mimetype: fileTypeExt(url),
diff --git a/src/components/settings_modal/helpers/attachment_setting.vue b/src/components/settings_modal/helpers/attachment_setting.vue
index 3a933511..cc2278b0 100644
--- a/src/components/settings_modal/helpers/attachment_setting.vue
+++ b/src/components/settings_modal/helpers/attachment_setting.vue
@@ -20,6 +20,23 @@
{{ backendDescriptionDescription + ' ' }}
@@ -63,8 +68,24 @@
.AttachmentSetting {
.attachment {
display: block;
- width: 20em;
+ width: 100%;
height: 15em;
+ margin-bottom: 0.5em;
+ }
+
+ .attachment-input {
+ margin-left: 1em;
+ display: flex;
+ flex-direction: column;
+ width: 20em;
+ }
+
+ .controls {
+ margin-bottom: 0.5em;
+
+ input, button {
+ width: 100%;
+ }
}
}
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 082ad826..44998453 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -519,6 +519,8 @@
"loop_video_silent_only": "Loop only videos without sound (i.e. Mastodon's \"gifs\")",
"mutes_tab": "Mutes",
"play_videos_in_modal": "Play videos in a popup frame",
+ "url": "URL",
+ "preview": "Preview",
"file_export_import": {
"backup_restore": "Settings backup",
"backup_settings": "Backup settings to file",
--
cgit v1.2.3-70-g09d2
From 1492937a7e8e27a31699879dc710d3e36c67b953 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Mon, 24 Apr 2023 23:01:29 +0300
Subject: lint
---
src/components/media_upload/media_upload.vue | 6 +--
.../settings_modal/admin_tabs/frontends_tab.vue | 56 ++++++++++++++++------
.../settings_modal/helpers/attachment_setting.vue | 9 ++--
.../settings_modal/helpers/number_setting.vue | 5 +-
.../settings_modal/helpers/string_setting.vue | 5 +-
src/components/settings_modal/settings_modal.vue | 13 +++--
6 files changed, 66 insertions(+), 28 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/media_upload/media_upload.vue b/src/components/media_upload/media_upload.vue
index c761b94f..993c01a4 100644
--- a/src/components/media_upload/media_upload.vue
+++ b/src/components/media_upload/media_upload.vue
@@ -1,7 +1,7 @@
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.vue b/src/components/settings_modal/admin_tabs/frontends_tab.vue
index 71bbfa69..e108a963 100644
--- a/src/components/settings_modal/admin_tabs/frontends_tab.vue
+++ b/src/components/settings_modal/admin_tabs/frontends_tab.vue
@@ -1,5 +1,8 @@
-
+
{{ $t('admin_dash.tabs.frontends') }}
{{ $t('admin_dash.frontend.wip_notice') }}
@@ -20,23 +23,26 @@
-
+
{{ $t('admin_dash.frontend.available_frontends') }}
-
+
{{ frontend.name }}
{{ ' ' }}
{{ adminDraft[':pleroma'][':frontends'][':primary'].ref }}
@@ -45,13 +51,30 @@
{{ $t('admin_dash.frontend.repository') }}
- {{ frontend.git }}
+
+ {{ frontend.git }}
+
{{ $t('admin_dash.frontend.versions') }}
- {{ ref }}
+
+ {{ ref }}
+
- {{ $t('admin_dash.frontend.build_url') }}
- {{ frontend.build_url }}
+
+ {{ $t('admin_dash.frontend.build_url') }}
+
+
+ {{ frontend.build_url }}
+
@@ -62,7 +85,7 @@
@click="update(frontend)"
>
{{
- frontend.installed
+ frontend.installed
? $t('admin_dash.frontend.reinstall')
: $t('admin_dash.frontend.install')
}}
@@ -100,19 +123,22 @@
-
+
{{
- $t('admin_dash.frontend.set_default')
+ $t('admin_dash.frontend.set_default')
}}
{{ ' ' }}
diff --git a/src/components/settings_modal/helpers/attachment_setting.vue b/src/components/settings_modal/helpers/attachment_setting.vue
index cc2278b0..0bede2c2 100644
--- a/src/components/settings_modal/helpers/attachment_setting.vue
+++ b/src/components/settings_modal/helpers/attachment_setting.vue
@@ -3,7 +3,10 @@
v-if="matchesExpertLevel"
class="AttachmentSetting"
>
-
+
{{ backendDescriptionLabel + ' ' }}
@@ -51,10 +54,10 @@
ref="mediaUpload"
class="media-upload-icon"
:drop-files="dropFiles"
- @uploaded="setMediaFile"
- @upload-failed="uploadFailed"
normal-button
:accept-types="acceptTypes"
+ @uploaded="setMediaFile"
+ @upload-failed="uploadFailed"
/>
diff --git a/src/components/settings_modal/helpers/number_setting.vue b/src/components/settings_modal/helpers/number_setting.vue
index ce168570..065cfbcf 100644
--- a/src/components/settings_modal/helpers/number_setting.vue
+++ b/src/components/settings_modal/helpers/number_setting.vue
@@ -3,7 +3,10 @@
v-if="matchesExpertLevel"
class="NumberSetting"
>
-
+
{{ backendDescriptionLabel + ' ' }}
diff --git a/src/components/settings_modal/helpers/string_setting.vue b/src/components/settings_modal/helpers/string_setting.vue
index 84d0a9d6..9de99d78 100644
--- a/src/components/settings_modal/helpers/string_setting.vue
+++ b/src/components/settings_modal/helpers/string_setting.vue
@@ -3,7 +3,10 @@
v-if="matchesExpertLevel"
class="StringSetting"
>
-
+
{{ backendDescriptionLabel + ' ' }}
diff --git a/src/components/settings_modal/settings_modal.vue b/src/components/settings_modal/settings_modal.vue
index 57ec5535..4e7fd931 100644
--- a/src/components/settings_modal/settings_modal.vue
+++ b/src/components/settings_modal/settings_modal.vue
@@ -125,21 +125,24 @@
id="unscrolled-content"
class="extra-content"
/>
-
+
- {{ $t("admin_dash.reset_all") }}
+ {{ $t("admin_dash.reset_all") }}
{{ ' ' }}
- {{ $t("admin_dash.commit_all") }}
+ {{ $t("admin_dash.commit_all") }}
--
cgit v1.2.3-70-g09d2
From 6816bc8badb34a41e41718b0d42e1021c974ff64 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Fri, 5 May 2023 01:50:41 +0300
Subject: remove unused stuff
---
.../settings_modal/admin_tabs/frontends_tab.vue | 8 +-
.../settings_modal/admin_tabs/instance_tab.vue | 108 ++++++---------------
.../settings_modal/admin_tabs/limits_tab.vue | 56 +++--------
3 files changed, 43 insertions(+), 129 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.vue b/src/components/settings_modal/admin_tabs/frontends_tab.vue
index e108a963..5281ef22 100644
--- a/src/components/settings_modal/admin_tabs/frontends_tab.vue
+++ b/src/components/settings_modal/admin_tabs/frontends_tab.vue
@@ -13,14 +13,10 @@
{{ $t('admin_dash.frontend.default_frontend_tip2') }}
-
- NAME
-
+
-
- REF
-
+
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index e519e135..d537adb6 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -4,34 +4,22 @@
{{ $t('admin_dash.instance.instance') }}
-
- NAME
-
+
-
- ADMIN EMAIL
-
+
-
- DESCRIPTION
-
+
-
- SHORT DESCRIPTION
-
+
-
- INSTANCE THUMBNAIL
-
+
-
- BACKGROUND IMAGE
-
+
@@ -39,53 +27,39 @@
{{ $t('admin_dash.instance.registrations') }}
-
- REGISTRATIONS OPEN
-
+
-
- BDEY REQUIRED
-
+
- BDEY age of consent
-
+ />
-
- ACTIVATION REQUIRED
-
+
-
- APPROVAL REQUIRED
-
+
{{ $t('admin_dash.instance.captcha_header') }}
-
- CAPTCHA
-
+
- CAPTCHA TYPE
-
+ />
- VALID
-
+ />
{{ $t('admin_dash.instance.kocaptcha') }}
-
- cockAPTCHA ENDPOINT
-
+
@@ -124,17 +92,13 @@
{{ $t('admin_dash.instance.access') }}
-
- PUBLIC
-
+
{{ $t('admin_dash.instance.restrict.header') }}
-
- SEARCH RESTRICTION
-
+
{{ $t('admin_dash.instance.restrict.timelines') }}
@@ -145,9 +109,7 @@
indeterminate-state=":if_instance_is_private"
swap-description-and-label
hide-description
- >
- LOCAL TIMELINES
-
+ />
- FED TIMELINES
-
+ />
-
- TIMELINES
-
+
{{ $t('admin_dash.instance.restrict.profiles') }}
@@ -173,9 +131,7 @@
indeterminate-state=":if_instance_is_private"
swap-description-and-label
hide-description
- >
- LOCAL PROFILES
-
+ />
- FED PROFILES
-
+ />
-
- PROFILES
-
+
{{ $t('admin_dash.instance.restrict.activities') }}
@@ -201,9 +153,7 @@
indeterminate-state=":if_instance_is_private"
swap-description-and-label
hide-description
- >
- LOCAL STATUSES
-
+ />
- FED STATUSES
-
+ />
-
- STATUSES
-
+
diff --git a/src/components/settings_modal/admin_tabs/limits_tab.vue b/src/components/settings_modal/admin_tabs/limits_tab.vue
index f7a70c97..068f2cda 100644
--- a/src/components/settings_modal/admin_tabs/limits_tab.vue
+++ b/src/components/settings_modal/admin_tabs/limits_tab.vue
@@ -11,9 +11,7 @@
source="admin"
path=":pleroma.:instance.:limit"
draft-mode
- >
- POST LIMIT
-
+ />
- POST LIMIT (remote)
-
+ />
{{ $t('admin_dash.limits.uploads') }}
@@ -33,27 +29,21 @@
source="admin"
path=":pleroma.:instance.:description_limit"
draft-mode
- >
- IMAGE DESCRIPTION LIMIT
-
+ />
- UPLOAD LIMIT KiB
-
+ />
- MAX ATTACHMENTS
-
+ />
{{ $t('admin_dash.limits.users') }}
@@ -63,27 +53,21 @@
source="admin"
path=":pleroma.:instance.:max_pinned_statuses"
draft-mode
- >
- MAX PINNED POSTS
-
+ />
- BIO LENGTH
-
+ />
- NAME LENGTH
-
+ />
{{ $t('admin_dash.limits.profile_fields') }}
@@ -93,9 +77,7 @@
source="admin"
path=":pleroma.:instance.:max_account_fields"
draft-mode
- >
- MAX ACCOUNT FIELDS
-
+ />
- MAX ACCOUNT FIELDS (remote)
-
+ />
- MAX ACCOUNT FIELD NAME
-
+ />
- MAX ACCOUNT VALUE NAME
-
+ />
{{ $t('admin_dash.limits.user_uploads') }}
@@ -133,18 +109,14 @@
source="admin"
path=":pleroma.:instance.:avatar_upload_limit"
draft-mode
- >
- MAX AVATAR SIZE KiB
-
+ />
- MAX BANNER SIZE KiB
-
+ />
--
cgit v1.2.3-70-g09d2
From b9c69a2272219865ff7e5b35dd1a0df7ead16538 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Mon, 8 May 2023 21:01:29 +0300
Subject: improve the semantics
---
.../settings_modal/admin_tabs/frontends_tab.vue | 28 +--
.../settings_modal/admin_tabs/limits_tab.vue | 222 +++++++++++----------
2 files changed, 130 insertions(+), 120 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.vue b/src/components/settings_modal/admin_tabs/frontends_tab.vue
index 5281ef22..f09e6a80 100644
--- a/src/components/settings_modal/admin_tabs/frontends_tab.vue
+++ b/src/components/settings_modal/admin_tabs/frontends_tab.vue
@@ -11,15 +11,17 @@
{{ $t('admin_dash.frontend.default_frontend') }}
{{ $t('admin_dash.frontend.default_frontend_tip') }}
{{ $t('admin_dash.frontend.default_frontend_tip2') }}
-
-
-
-
-
-
-
-
-
+
@@ -77,7 +79,6 @@
{{
@@ -112,7 +113,7 @@
@@ -120,7 +121,7 @@
{{
@@ -164,7 +164,7 @@
diff --git a/src/components/settings_modal/admin_tabs/limits_tab.vue b/src/components/settings_modal/admin_tabs/limits_tab.vue
index 068f2cda..ef4b9271 100644
--- a/src/components/settings_modal/admin_tabs/limits_tab.vue
+++ b/src/components/settings_modal/admin_tabs/limits_tab.vue
@@ -5,118 +5,128 @@
{{ $t('admin_dash.limits.posts') }}
-
-
-
-
-
-
+
{{ $t('admin_dash.limits.uploads') }}
-
-
-
-
-
-
-
-
-
+
{{ $t('admin_dash.limits.users') }}
-
-
-
-
-
-
-
-
-
-
-
- {{ $t('admin_dash.limits.profile_fields') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ $t('admin_dash.limits.user_uploads') }}
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('admin_dash.limits.profile_fields') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('admin_dash.limits.user_uploads') }}
+
+
+
--
cgit v1.2.3-70-g09d2
From 05a7e612aa6d9f2a44eea22266b325933da6f5ad Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Mon, 8 May 2023 21:10:06 +0300
Subject: show warning for developer for missing labels
---
.../settings_modal/helpers/attachment_setting.vue | 5 +++--
.../settings_modal/helpers/boolean_setting.vue | 16 +++++++++++++---
src/components/settings_modal/helpers/number_setting.vue | 5 +++--
src/components/settings_modal/helpers/string_setting.vue | 5 +++--
4 files changed, 22 insertions(+), 9 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/helpers/attachment_setting.vue b/src/components/settings_modal/helpers/attachment_setting.vue
index 0bede2c2..447fa172 100644
--- a/src/components/settings_modal/helpers/attachment_setting.vue
+++ b/src/components/settings_modal/helpers/attachment_setting.vue
@@ -10,9 +10,10 @@
{{ backendDescriptionLabel + ' ' }}
-
-
+
+ MISSING LABEL FOR {{ path }}
+
{{ backendDescriptionLabel }}
-
-
+
+ MISSING LABEL FOR {{ path }}
+
{{ backendDescriptionDescription + ' ' }}
+
+
diff --git a/src/components/settings_modal/helpers/number_setting.vue b/src/components/settings_modal/helpers/number_setting.vue
index 065cfbcf..93f11331 100644
--- a/src/components/settings_modal/helpers/number_setting.vue
+++ b/src/components/settings_modal/helpers/number_setting.vue
@@ -10,9 +10,10 @@
{{ backendDescriptionLabel + ' ' }}
-
-
+
+ MISSING LABEL FOR {{ path }}
+
{{ backendDescriptionLabel + ' ' }}
-
-
+
+ MISSING LABEL FOR {{ path }}
+
Date: Mon, 8 May 2023 21:11:48 +0300
Subject: remove restriction on number input's width
---
src/components/settings_modal/settings_modal_admin_content.scss | 4 ----
src/components/settings_modal/settings_modal_user_content.scss | 4 ----
2 files changed, 8 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/settings_modal_admin_content.scss b/src/components/settings_modal/settings_modal_admin_content.scss
index 87df7982..c984d703 100644
--- a/src/components/settings_modal/settings_modal_admin_content.scss
+++ b/src/components/settings_modal/settings_modal_admin_content.scss
@@ -48,9 +48,5 @@
color: var(--cRed, $fallback--cRed);
color: $fallback--cRed;
}
-
- .number-input {
- max-width: 6em;
- }
}
}
diff --git a/src/components/settings_modal/settings_modal_user_content.scss b/src/components/settings_modal/settings_modal_user_content.scss
index 87df7982..c984d703 100644
--- a/src/components/settings_modal/settings_modal_user_content.scss
+++ b/src/components/settings_modal/settings_modal_user_content.scss
@@ -48,9 +48,5 @@
color: var(--cRed, $fallback--cRed);
color: $fallback--cRed;
}
-
- .number-input {
- max-width: 6em;
- }
}
}
--
cgit v1.2.3-70-g09d2
From 2322646442365b0575393a897098a90c3bdc961f Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Mon, 8 May 2023 21:13:07 +0300
Subject: reintroduce width limit on number input but only for sizesetting
---
.../settings_modal/helpers/size_setting.vue | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/helpers/size_setting.vue b/src/components/settings_modal/helpers/size_setting.vue
index 5a78f100..6c3fbaeb 100644
--- a/src/components/settings_modal/helpers/size_setting.vue
+++ b/src/components/settings_modal/helpers/size_setting.vue
@@ -45,11 +45,18 @@
--
cgit v1.2.3-70-g09d2
From 09e3735e375b9b8248d9aa1153d065a118abca58 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Mon, 8 May 2023 21:36:18 +0300
Subject: semantics + description for instance access section
---
.../settings_modal/admin_tabs/instance_tab.vue | 206 ++++++++++++---------
src/i18n/en.json | 11 +-
2 files changed, 124 insertions(+), 93 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index d537adb6..a7ef0f68 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -57,32 +57,35 @@
{{ $t('admin_dash.instance.captcha_header') }}
-
-
-
-
+
-
- {{ $t('admin_dash.instance.kocaptcha') }}
-
-
+
+
+
+
+
+
+
+ {{ $t('admin_dash.instance.kocaptcha') }}
+
+
+
@@ -91,80 +94,99 @@
{{ $t('admin_dash.instance.access') }}
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 072ce952..33f48225 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -869,7 +869,8 @@
"kocaptcha": "KoCaptcha settings",
"access": "Instance access",
"restrict": {
- "header": "Restrict access",
+ "header": "Restrict access for anonymous visitors",
+ "description": "Detailed setting for allowing/disallowing access to certain aspects of API. By default (indeterminate state) it will disallow if instance is not public, ticked checkbox means disallow access even if instance is public, unticked means allow access even if instance is private. Please note that unexpected behavior might happen if some settings are set, i.e. if profile access is disabled posts will show without profile information.",
"timelines": "Timelines access",
"profiles": "User profiles access",
"activities": "Statues/activities access"
@@ -905,6 +906,14 @@
"temp_overrides": {
":pleroma": {
":instance": {
+ ":public": {
+ "label": "Instance is public",
+ "description": "Disabling this will make all API accessible only for logged-in users, this will make Public and Federated timelines inaccessible to anonymous visitors."
+ },
+ ":limit_to_local_content": {
+ "label": "Limit search to local content",
+ "description": "Disables global network search for unauthenticated (default), all users or none"
+ },
":description_limit": {
"label": "Limit",
"description": "Character limit for attachment descriptions"
--
cgit v1.2.3-70-g09d2
From 039b6c61a2ac0c64b1d24295374401f8bf56af0a Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Mon, 8 May 2023 21:37:29 +0300
Subject: lint
---
.../settings_modal/admin_tabs/frontends_tab.vue | 4 +-
.../settings_modal/admin_tabs/instance_tab.vue | 44 +++++++++++-----------
2 files changed, 24 insertions(+), 24 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.vue b/src/components/settings_modal/admin_tabs/frontends_tab.vue
index f09e6a80..13b8fa6b 100644
--- a/src/components/settings_modal/admin_tabs/frontends_tab.vue
+++ b/src/components/settings_modal/admin_tabs/frontends_tab.vue
@@ -13,10 +13,10 @@
{{ $t('admin_dash.frontend.default_frontend_tip2') }}
-
+
-
+
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index a7ef0f68..cbc578f1 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -4,22 +4,22 @@
{{ $t('admin_dash.instance.instance') }}
@@ -27,7 +27,7 @@
{{ $t('admin_dash.instance.registrations') }}
-
+
-
+
-
+
-
+
{{ $t('admin_dash.instance.captcha_header') }}
-
+
{{ $t('admin_dash.instance.kocaptcha') }}
@@ -99,7 +99,7 @@
override-backend-description
override-backend-description-label
path=":pleroma.:instance.:public"
- />
+ />
+ />
+ />
-
+
@@ -147,7 +147,7 @@
indeterminate-state=":if_instance_is_private"
swap-description-and-label
hide-description
- />
+ />
+ />
-
+
@@ -171,7 +171,7 @@
indeterminate-state=":if_instance_is_private"
swap-description-and-label
hide-description
- />
+ />
+ />
-
+
--
cgit v1.2.3-70-g09d2
From b79f297692eeca5e774a1dd124cec2b3bc41b977 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Mon, 8 May 2023 22:04:05 +0300
Subject: fix double pushbuttons in the draft buttons
---
src/components/popover/popover.js | 3 ++
src/components/popover/popover.vue | 3 +-
.../settings_modal/helpers/draft_buttons.vue | 40 +++++++---------------
3 files changed, 18 insertions(+), 28 deletions(-)
(limited to 'src/components/settings_modal')
diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js
index d44b266b..bc078533 100644
--- a/src/components/popover/popover.js
+++ b/src/components/popover/popover.js
@@ -45,6 +45,9 @@ const Popover = {
// Lets hover popover stay when clicking inside of it
stayOnClick: Boolean,
+ // Use styled button (to avoid nested buttons)
+ normalButton: Boolean,
+
triggerAttrs: {
type: Object,
default: {}
diff --git a/src/components/popover/popover.vue b/src/components/popover/popover.vue
index fd0fd821..1a4bffd9 100644
--- a/src/components/popover/popover.vue
+++ b/src/components/popover/popover.vue
@@ -5,7 +5,8 @@
>
-
-
- {{ $t('settings.commit_value') }}
-
+ {{ $t('settings.commit_value') }}