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') }}
</button>
</p>
<div
@click="toggleExpandedSettings"

View file

@ -12,6 +12,7 @@ import InterfaceLanguageSwitcher from 'src/components/interface_language_switche
import BooleanSetting from '../helpers/boolean_setting.vue'
import SharedComputedObject from '../helpers/shared_computed_object.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 {
@ -46,9 +47,16 @@ const ProfileTab = {
emailLanguage: this.$store.state.users.currentUser.language || '',
newPostTTLDays: this.$store.state.users.currentUser.status_ttl_days,
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: {
ChoiceSetting,
ScopeSelector,
ImageCropper,
EmojiInput,
@ -126,7 +134,8 @@ const ProfileTab = {
fields_attributes: this.newFields.filter(el => el != null),
bot: this.bot,
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 */
}

View file

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

View file

@ -929,6 +929,10 @@
"user_profile_default_tab": "Default Tab on User Profile",
"user_profiles": "User Profiles",
"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",
"values": {
"false": "no",

View file

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