Add DM settings

This commit is contained in:
FloatingGhost 2023-05-23 13:46:59 +01:00
parent 17c05a5ca2
commit 2f479c670f
5 changed files with 27 additions and 2 deletions

View file

@ -21,7 +21,6 @@
> >
{{ $t('settings.settings_profile_force_sync') }} {{ $t('settings.settings_profile_force_sync') }}
</button> </button>
</p> </p>
<div <div
@click="toggleExpandedSettings" @click="toggleExpandedSettings"

View file

@ -12,6 +12,7 @@ import InterfaceLanguageSwitcher from 'src/components/interface_language_switche
import BooleanSetting from '../helpers/boolean_setting.vue' import BooleanSetting from '../helpers/boolean_setting.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js' import SharedComputedObject from '../helpers/shared_computed_object.js'
import localeService from 'src/services/locale/locale.service.js' import localeService from 'src/services/locale/locale.service.js'
import ChoiceSetting from '../helpers/choice_setting.vue'
import { library } from '@fortawesome/fontawesome-svg-core' import { library } from '@fortawesome/fontawesome-svg-core'
import { import {
@ -46,9 +47,16 @@ const ProfileTab = {
emailLanguage: this.$store.state.users.currentUser.language || '', emailLanguage: this.$store.state.users.currentUser.language || '',
newPostTTLDays: this.$store.state.users.currentUser.status_ttl_days, newPostTTLDays: this.$store.state.users.currentUser.status_ttl_days,
expirePosts: this.$store.state.users.currentUser.status_ttl_days !== null, expirePosts: this.$store.state.users.currentUser.status_ttl_days !== null,
userAcceptsDirectMessagesFrom: this.$store.state.users.currentUser.accepts_direct_messages_from,
userAcceptsDirectMessagesFromOptions: ["everybody", "nobody", "people_i_follow"].map(mode => ({
key: mode,
value: mode,
label: this.$t(`settings.user_accepts_direct_messages_from_${mode}`)
}))
} }
}, },
components: { components: {
ChoiceSetting,
ScopeSelector, ScopeSelector,
ImageCropper, ImageCropper,
EmojiInput, EmojiInput,
@ -126,7 +134,8 @@ const ProfileTab = {
fields_attributes: this.newFields.filter(el => el != null), fields_attributes: this.newFields.filter(el => el != null),
bot: this.bot, bot: this.bot,
show_role: this.showRole, show_role: this.showRole,
status_ttl_days: this.expirePosts ? this.newPostTTLDays : -1 status_ttl_days: this.expirePosts ? this.newPostTTLDays : -1,
accepts_direct_messages_from: this.userAcceptsDirectMessagesFrom
/* eslint-enable camelcase */ /* eslint-enable camelcase */
} }

View file

@ -89,6 +89,15 @@
{{ $t('settings.bot') }} {{ $t('settings.bot') }}
</Checkbox> </Checkbox>
</p> </p>
<p>
<ChoiceSetting
id="userAcceptsDirectMessagesFrom"
path="userAcceptsDirectMessagesFrom"
:options="userAcceptsDirectMessagesFromOptions"
>
{{ $t('settings.user_accepts_direct_messages_from') }}
</ChoiceSetting>
</p>
<p> <p>
<Checkbox v-model="expirePosts"> <Checkbox v-model="expirePosts">
{{ $t('settings.expire_posts_enabled') }} {{ $t('settings.expire_posts_enabled') }}
@ -102,6 +111,9 @@
class="expire-posts-days" class="expire-posts-days"
:placeholder="$t('settings.expire_posts_input_placeholder')" :placeholder="$t('settings.expire_posts_input_placeholder')"
/> />
</p>
<p>
</p> </p>
<p> <p>
<interface-language-switcher <interface-language-switcher

View file

@ -929,6 +929,10 @@
"user_profile_default_tab": "Default Tab on User Profile", "user_profile_default_tab": "Default Tab on User Profile",
"user_profiles": "User Profiles", "user_profiles": "User Profiles",
"user_settings": "User Settings", "user_settings": "User Settings",
"user_accepts_direct_messages_from": "Accept DMs From",
"user_accepts_direct_messages_from_everybody": "Everybody",
"user_accepts_direct_messages_from_nobody": "Nobody",
"user_accepts_direct_messages_from_people_i_follow": "People I follow",
"valid_until": "Valid until", "valid_until": "Valid until",
"values": { "values": {
"false": "no", "false": "no",

View file

@ -90,6 +90,7 @@ export const parseUser = (data) => {
output.friends_count = data.following_count output.friends_count = data.following_count
output.bot = data.bot output.bot = data.bot
output.accepts_direct_messages_from = data.accepts_direct_messages_from
output.follow_requests_count = data.follow_requests_count output.follow_requests_count = data.follow_requests_count
if (data.akkoma) { if (data.akkoma) {
output.instance = data.akkoma.instance output.instance = data.akkoma.instance