aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_status
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-08-15 14:39:56 +0200
committerJoas Schilling <coding@schilljs.com>2024-08-21 07:06:24 +0200
commitb0205d7481e10b35e54667143bdd7a653e73d3ba (patch)
tree0a29753cc608a5f966d8ec0614c12e5a23a58481 /apps/user_status
parent85059d8b0537cfbe933dcaaf4ce9e2a2e057741f (diff)
downloadnextcloud-server-b0205d7481e10b35e54667143bdd7a653e73d3ba.tar.gz
nextcloud-server-b0205d7481e10b35e54667143bdd7a653e73d3ba.zip
fix(userstatus): Don't set predefined user status as custom when changing "Clear at"
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/user_status')
-rw-r--r--apps/user_status/src/components/SetStatusModal.vue24
1 files changed, 19 insertions, 5 deletions
diff --git a/apps/user_status/src/components/SetStatusModal.vue b/apps/user_status/src/components/SetStatusModal.vue
index 682e3c8e8ca..f281829a83b 100644
--- a/apps/user_status/src/components/SetStatusModal.vue
+++ b/apps/user_status/src/components/SetStatusModal.vue
@@ -125,6 +125,7 @@ export default {
return {
clearAt: null,
editedMessage: '',
+ predefinedMessageId: null,
isSavingStatus: false,
statuses: getAllStatusOptions(),
}
@@ -192,6 +193,7 @@ export default {
mounted() {
this.$store.dispatch('fetchBackupFromServer')
+ this.predefinedMessageId = this.$store.state.userStatus.messageId
if (this.$store.state.userStatus.clearAt !== null) {
this.clearAt = {
type: '_time',
@@ -212,6 +214,7 @@ export default {
* @param {string} icon The new icon
*/
setIcon(icon) {
+ this.predefinedMessageId = null
this.$store.dispatch('setCustomMessage', {
message: this.message,
icon,
@@ -227,6 +230,7 @@ export default {
* @param {string} message The new message
*/
setMessage(message) {
+ this.predefinedMessageId = null
this.editedMessage = message
},
/**
@@ -243,6 +247,7 @@ export default {
* @param {object} status The predefined status object
*/
selectPredefinedMessage(status) {
+ this.predefinedMessageId = status.id
this.clearAt = status.clearAt
this.$store.dispatch('setPredefinedMessage', {
messageId: status.id,
@@ -262,11 +267,18 @@ export default {
try {
this.isSavingStatus = true
- await this.$store.dispatch('setCustomMessage', {
- message: this.editedMessage,
- icon: this.icon,
- clearAt: this.clearAt,
- })
+ if (this.predefinedMessageId === null) {
+ await this.$store.dispatch('setCustomMessage', {
+ message: this.editedMessage,
+ icon: this.icon,
+ clearAt: this.clearAt,
+ })
+ } else {
+ this.$store.dispatch('setPredefinedMessage', {
+ messageId: this.predefinedMessageId,
+ clearAt: this.clearAt,
+ })
+ }
} catch (err) {
showError(this.$t('user_status', 'There was an error saving the status'))
console.debug(err)
@@ -294,6 +306,7 @@ export default {
}
this.isSavingStatus = false
+ this.predefinedMessageId = null
this.closeModal()
},
/**
@@ -315,6 +328,7 @@ export default {
}
this.isSavingStatus = false
+ this.predefinedMessageId = this.$store.state.userStatus?.messageId
},
},
}