aboutsummaryrefslogtreecommitdiff
path: root/src/components/settings_modal/tabs/profile_tab.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2022-06-08 02:13:47 +0300
committerHenry Jameson <me@hjkos.com>2022-06-08 02:13:47 +0300
commit1154a6514bf5596aa55aa415e1640560bd3716b3 (patch)
tree4c088c0b9d02a827b8f5d2a055631854cf645df7 /src/components/settings_modal/tabs/profile_tab.js
parentfd831a27f4e9c6bcd5c40f3449d63546fba2560d (diff)
parent0aa334515bd67ca69e84177c22273592f694fc28 (diff)
Merge remote-tracking branch 'origin/develop' into disjointed-popovers
* origin/develop: (25 commits) force panel headers to be square on mobile (for now?) fix gap between panel heading and timeline menu Fix Open Chat button fix? fix Revert "Merge branch 'revert-a88abc7e' into 'develop'" Revert "Merge branch 'from/develop/tusooa/lang-opts' into 'develop'" Fix registration error stick chat scroll to bottom to help with OSK resizing the viewport Pass file name of cropped avatar to form data Add English translation for filtering end-of-poll notifications Add settings for filtering end-of-poll notifications Add English translations for poll-end notifications Show poll-end notifications Fix virtual scrolling when the user has a lot of pinned statuses Update dependency @vuelidate/core to v2.0.0-alpha.41 Make lint happy Make lint happy Add English translation for language options Add email language option to registration form ...
Diffstat (limited to 'src/components/settings_modal/tabs/profile_tab.js')
-rw-r--r--src/components/settings_modal/tabs/profile_tab.js46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/components/settings_modal/tabs/profile_tab.js b/src/components/settings_modal/tabs/profile_tab.js
index bee8a7bb..8781bb91 100644
--- a/src/components/settings_modal/tabs/profile_tab.js
+++ b/src/components/settings_modal/tabs/profile_tab.js
@@ -8,8 +8,10 @@ import EmojiInput from 'src/components/emoji_input/emoji_input.vue'
import suggestor from 'src/components/emoji_input/suggestor.js'
import Autosuggest from 'src/components/autosuggest/autosuggest.vue'
import Checkbox from 'src/components/checkbox/checkbox.vue'
+import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
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 { library } from '@fortawesome/fontawesome-svg-core'
import {
@@ -40,7 +42,8 @@ const ProfileTab = {
banner: null,
bannerPreview: null,
background: null,
- backgroundPreview: null
+ backgroundPreview: null,
+ emailLanguage: this.$store.state.users.currentUser.language || ''
}
},
components: {
@@ -50,7 +53,8 @@ const ProfileTab = {
Autosuggest,
ProgressButton,
Checkbox,
- BooleanSetting
+ BooleanSetting,
+ InterfaceLanguageSwitcher
},
computed: {
user () {
@@ -111,19 +115,25 @@ const ProfileTab = {
},
methods: {
updateProfile () {
+ const params = {
+ note: this.newBio,
+ locked: this.newLocked,
+ // Backend notation.
+ /* eslint-disable camelcase */
+ display_name: this.newName,
+ fields_attributes: this.newFields.filter(el => el != null),
+ bot: this.bot,
+ show_role: this.showRole
+ /* eslint-enable camelcase */
+ }
+
+ if (this.emailLanguage) {
+ params.language = localeService.internalToBackendLocale(this.emailLanguage)
+ }
+
this.$store.state.api.backendInteractor
- .updateProfile({
- params: {
- note: this.newBio,
- locked: this.newLocked,
- // Backend notation.
- /* eslint-disable camelcase */
- display_name: this.newName,
- fields_attributes: this.newFields.filter(el => el != null),
- bot: this.bot,
- show_role: this.showRole
- /* eslint-enable camelcase */
- } }).then((user) => {
+ .updateProfile({ params })
+ .then((user) => {
this.newFields.splice(user.fields.length)
merge(this.newFields, user.fields)
this.$store.commit('addNewUsers', [user])
@@ -193,8 +203,8 @@ const ProfileTab = {
submitAvatar (cropper, file) {
const that = this
return new Promise((resolve, reject) => {
- function updateAvatar (avatar) {
- that.$store.state.api.backendInteractor.updateProfileImages({ avatar })
+ function updateAvatar (avatar, avatarName) {
+ that.$store.state.api.backendInteractor.updateProfileImages({ avatar, avatarName })
.then((user) => {
that.$store.commit('addNewUsers', [user])
that.$store.commit('setCurrentUser', user)
@@ -207,9 +217,9 @@ const ProfileTab = {
}
if (cropper) {
- cropper.getCroppedCanvas().toBlob(updateAvatar, file.type)
+ cropper.getCroppedCanvas().toBlob((data) => updateAvatar(data, file.name), file.type)
} else {
- updateAvatar(file)
+ updateAvatar(file, file.name)
}
})
},