summaryrefslogtreecommitdiffstats
path: root/apps/user_status
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-04-14 15:28:43 +0200
committerMaksim Sukharev <antreesy.web@gmail.com>2023-04-18 14:58:12 +0200
commitc90d414fdfc2e573f99f000e1e9717c5fd6a8126 (patch)
treed8d49be914effccdb38c269045c73d7a61269ac7 /apps/user_status
parent90a817cee5e22076f5aaa2c8a029d2316857d4fa (diff)
downloadnextcloud-server-c90d414fdfc2e573f99f000e1e9717c5fd6a8126.tar.gz
nextcloud-server-c90d414fdfc2e573f99f000e1e9717c5fd6a8126.zip
fix(status): Correctly set the message and predefined message using the store
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/user_status')
-rw-r--r--apps/user_status/src/components/SetStatusModal.vue28
-rw-r--r--apps/user_status/src/store/userBackupStatus.js8
2 files changed, 25 insertions, 11 deletions
diff --git a/apps/user_status/src/components/SetStatusModal.vue b/apps/user_status/src/components/SetStatusModal.vue
index f4b528a5a92..0ee8b3a1e18 100644
--- a/apps/user_status/src/components/SetStatusModal.vue
+++ b/apps/user_status/src/components/SetStatusModal.vue
@@ -48,11 +48,11 @@
@submit="saveStatus"
@select-icon="setIcon" />
</div>
- <div v-if="messageId"
+ <div v-if="hasBackupStatus"
class="set-status-modal__automation-hint">
{{ $t('user_status', 'Your status was set automatically') }}
</div>
- <PreviousStatus v-if="messageId"
+ <PreviousStatus v-if="hasBackupStatus"
:icon="backupIcon"
:message="backupMessage"
@select="revertBackupFromServer" />
@@ -123,6 +123,9 @@ export default {
message() {
return this.$store.state.userStatus.message || ''
},
+ hasBackupStatus() {
+ return this.messageId && (this.backupIcon || this.backupMessage)
+ },
backupIcon() {
return this.$store.state.userBackupStatus.icon || ''
},
@@ -176,8 +179,11 @@ export default {
* @param {string} icon The new icon
*/
setIcon(icon) {
- this.messageId = null
- this.icon = icon
+ this.$store.dispatch('setCustomMessage', {
+ message: this.message,
+ icon,
+ clearAt: this.clearAt,
+ })
this.$nextTick(() => {
this.$refs.customMessageInput.focus()
})
@@ -188,8 +194,11 @@ export default {
* @param {string} message The new message
*/
setMessage(message) {
- this.messageId = null
- this.message = message
+ this.$store.dispatch('setCustomMessage', {
+ message,
+ icon: this.icon,
+ clearAt: this.clearAt,
+ })
},
/**
* Sets a new clearAt value
@@ -205,10 +214,11 @@ export default {
* @param {object} status The predefined status object
*/
selectPredefinedMessage(status) {
- this.messageId = status.id
this.clearAt = status.clearAt
- this.icon = status.icon
- this.message = status.message
+ this.$store.dispatch('setPredefinedMessage', {
+ messageId: status.id,
+ clearAt: status.clearAt,
+ })
},
/**
* Saves the status and closes the
diff --git a/apps/user_status/src/store/userBackupStatus.js b/apps/user_status/src/store/userBackupStatus.js
index c4258d998be..15f870112ca 100644
--- a/apps/user_status/src/store/userBackupStatus.js
+++ b/apps/user_status/src/store/userBackupStatus.js
@@ -94,8 +94,12 @@ const actions = {
* @return {Promise<void>}
*/
async fetchBackupFromServer({ commit }) {
- const status = await fetchBackupStatus(getCurrentUser()?.uid)
- commit('loadBackupStatusFromServer', status)
+ try {
+ const status = await fetchBackupStatus(getCurrentUser()?.uid)
+ commit('loadBackupStatusFromServer', status)
+ } catch (e) {
+ // Ignore missing user backup status
+ }
},
async revertBackupFromServer({ commit }, { messageId }) {