Date: Fri, 22 Mar 2019 13:00:58 -0400
Subject: Update avatar uploading
---
src/components/image_cropper/image_cropper.js | 16 ++--------------
src/components/image_cropper/image_cropper.vue | 4 ++--
src/components/user_settings/user_settings.js | 9 +++++----
3 files changed, 9 insertions(+), 20 deletions(-)
(limited to 'src/components/user_settings/user_settings.js')
diff --git a/src/components/image_cropper/image_cropper.js b/src/components/image_cropper/image_cropper.js
index 5ba8f04e..01361e25 100644
--- a/src/components/image_cropper/image_cropper.js
+++ b/src/components/image_cropper/image_cropper.js
@@ -70,22 +70,10 @@ const ImageCropper = {
this.dataUrl = undefined
this.$emit('close')
},
- submit () {
+ submit (cropping = true) {
this.submitting = true
this.avatarUploadError = null
- this.submitHandler(this.cropper, this.file)
- .then(() => this.destroy())
- .catch((err) => {
- this.submitError = err
- })
- .finally(() => {
- this.submitting = false
- })
- },
- submitWithoutCropping () {
- this.submitting = true
- this.avatarUploadError = null
- this.submitHandler(false, this.dataUrl)
+ this.submitHandler(cropping && this.cropper, this.file)
.then(() => this.destroy())
.catch((err) => {
this.submitError = err
diff --git a/src/components/image_cropper/image_cropper.vue b/src/components/image_cropper/image_cropper.vue
index 129e6f46..d2b86e9e 100644
--- a/src/components/image_cropper/image_cropper.vue
+++ b/src/components/image_cropper/image_cropper.vue
@@ -5,9 +5,9 @@
-
+
-
+
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index 6b367e4f..820feba6 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -163,16 +163,17 @@ const UserSettings = {
reader.readAsDataURL(file)
},
submitAvatar (cropper, file) {
+ const that = this
return new Promise((resolve, reject) => {
function updateAvatar (avatar) {
- this.$store.state.api.backendInteractor.updateAvatar({ avatar })
+ that.$store.state.api.backendInteractor.updateAvatar({ avatar })
.then((user) => {
- this.$store.commit('addNewUsers', [user])
- this.$store.commit('setCurrentUser', user)
+ that.$store.commit('addNewUsers', [user])
+ that.$store.commit('setCurrentUser', user)
resolve()
})
.catch((err) => {
- reject(new Error(this.$t('upload.error.base') + ' ' + err.message))
+ reject(new Error(that.$t('upload.error.base') + ' ' + err.message))
})
}
--
cgit v1.2.3-70-g09d2
From 2c4af6693ac87f5008566b6d9a61e9b4c9b3bdd8 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Sat, 27 Apr 2019 14:04:30 -0400
Subject: clean up
---
src/components/user_settings/user_settings.js | 30 +++++++++------------------
1 file changed, 10 insertions(+), 20 deletions(-)
(limited to 'src/components/user_settings/user_settings.js')
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index 820feba6..ae4d0694 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -110,31 +110,21 @@ const UserSettings = {
},
methods: {
updateProfile () {
- const note = this.newBio
- const locked = this.newLocked
- // Backend notation.
- /* eslint-disable camelcase */
- const display_name = this.newName
- const default_scope = this.newDefaultScope
- const no_rich_text = this.newNoRichText
- const hide_follows = this.hideFollows
- const hide_followers = this.hideFollowers
- const show_role = this.showRole
-
- /* eslint-enable camelcase */
this.$store.state.api.backendInteractor
.updateProfile({
params: {
- display_name,
- note,
- locked,
+ note: this.newBio,
+ locked: this.newLocked,
+ source: {
+ privacy: this.newDefaultScope
+ },
// Backend notation.
/* eslint-disable camelcase */
- default_scope,
- no_rich_text,
- hide_follows,
- hide_followers,
- show_role
+ display_name: this.newName,
+ no_rich_text: this.newNoRichText,
+ hide_follows: this.hideFollows,
+ hide_followers: this.hideFollowers,
+ show_role: this.showRole
/* eslint-enable camelcase */
}}).then((user) => {
this.$store.commit('addNewUsers', [user])
--
cgit v1.2.3-70-g09d2
From 3665c86d709f3a04ae3471d09b84a69c8a8c9172 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Sat, 27 Apr 2019 21:51:17 -0400
Subject: use default_scope parameter
---
src/components/user_settings/user_settings.js | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
(limited to 'src/components/user_settings/user_settings.js')
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index ae4d0694..5a7ff448 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -115,12 +115,10 @@ const UserSettings = {
params: {
note: this.newBio,
locked: this.newLocked,
- source: {
- privacy: this.newDefaultScope
- },
// Backend notation.
/* eslint-disable camelcase */
display_name: this.newName,
+ default_scope: this.newDefaultScope,
no_rich_text: this.newNoRichText,
hide_follows: this.hideFollows,
hide_followers: this.hideFollowers,
--
cgit v1.2.3-70-g09d2