Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't save translated predefined user status as custom status #47258

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions apps/user_status/src/components/SetStatusModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default {
return {
clearAt: null,
editedMessage: '',
predefinedMessageId: null,
isSavingStatus: false,
statuses: getAllStatusOptions(),
}
Expand Down Expand Up @@ -176,6 +177,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',
Expand All @@ -196,6 +198,7 @@ export default {
* @param {string} icon The new icon
*/
setIcon(icon) {
this.predefinedMessageId = null
this.$store.dispatch('setCustomMessage', {
message: this.message,
icon,
Expand All @@ -211,6 +214,7 @@ export default {
* @param {string} message The new message
*/
setMessage(message) {
this.predefinedMessageId = null
this.editedMessage = message
},
/**
Expand All @@ -227,6 +231,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,
Expand All @@ -246,11 +251,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)
Expand Down Expand Up @@ -278,6 +290,7 @@ export default {
}

this.isSavingStatus = false
this.predefinedMessageId = null
this.closeModal()
},
/**
Expand All @@ -299,6 +312,7 @@ export default {
}

this.isSavingStatus = false
this.predefinedMessageId = this.$store.state.userStatus?.messageId
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions dist/user-status-modal-5133.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/user-status-modal-5133.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/user_status-menu.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/user_status-menu.js.map

Large diffs are not rendered by default.

Loading