Merge pull request #38832 from nextcloud/fix/38817/correct-user-status-save

Adjust saving of status messages
pull/39052/head
Maksim Sukharev 2023-06-28 19:35:28 +07:00 committed by GitHub
commit 8c73fedf95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 50 additions and 60 deletions

@ -38,9 +38,7 @@
:placeholder="$t('user_status', 'What is your status?')"
type="text"
:value="message"
@change="onChange"
@keyup="onKeyup"
@paste="onKeyup">
@input="onChange">
</div>
</div>
</template>
@ -100,12 +98,8 @@ export default {
*
* @param {Event} event The Change Event
*/
onKeyup(event) {
this.$emit('change', event.target.value)
},
onChange(event) {
this.$emit('submit', event.target.value)
this.$emit('change', event.target.value)
},
setIcon(icon) {

@ -38,45 +38,46 @@
@select="changeStatus" />
</div>
<!-- Status message -->
<div class="set-status-modal__header">
<h2>{{ $t('user_status', 'Status message') }}</h2>
</div>
<div class="set-status-modal__custom-input">
<CustomMessageInput ref="customMessageInput"
:icon="icon"
:message="editedMessage"
@change="setMessage"
@submit="saveStatus"
@select-icon="setIcon" />
</div>
<div v-if="hasBackupStatus"
class="set-status-modal__automation-hint">
{{ $t('user_status', 'Your status was set automatically') }}
</div>
<PreviousStatus v-if="hasBackupStatus"
:icon="backupIcon"
:message="backupMessage"
@select="revertBackupFromServer" />
<PredefinedStatusesList :is-custom-status="isCustomStatus" @select-status="selectPredefinedMessage" />
<ClearAtSelect :clear-at="clearAt"
@select-clear-at="setClearAt" />
<div class="status-buttons">
<NcButton :wide="true"
type="tertiary"
:text="$t('user_status', 'Clear status message')"
:disabled="isSavingStatus"
@click="clearStatus">
{{ $t('user_status', 'Clear status message') }}
</NcButton>
<NcButton :wide="true"
type="primary"
:text="$t('user_status', 'Set status message')"
:disabled="isSavingStatus"
@click="saveStatus">
{{ $t('user_status', 'Set status message') }}
</NcButton>
</div>
<!-- Status message form -->
<form @submit.prevent="saveStatus" @reset="clearStatus">
<div class="set-status-modal__header">
<h2>{{ $t('user_status', 'Status message') }}</h2>
</div>
<div class="set-status-modal__custom-input">
<CustomMessageInput ref="customMessageInput"
:icon="icon"
:message="editedMessage"
@change="setMessage"
@select-icon="setIcon" />
</div>
<div v-if="hasBackupStatus"
class="set-status-modal__automation-hint">
{{ $t('user_status', 'Your status was set automatically') }}
</div>
<PreviousStatus v-if="hasBackupStatus"
:icon="backupIcon"
:message="backupMessage"
@select="revertBackupFromServer" />
<PredefinedStatusesList :is-custom-status="isCustomStatus" @select-status="selectPredefinedMessage" />
<ClearAtSelect :clear-at="clearAt"
@select-clear-at="setClearAt" />
<div class="status-buttons">
<NcButton :wide="true"
type="tertiary"
native-type="reset"
:aria-label="$t('user_status', 'Clear status message')"
:disabled="isSavingStatus">
{{ $t('user_status', 'Clear status message') }}
</NcButton>
<NcButton :wide="true"
type="primary"
native-type="submit"
:aria-label="$t('user_status', 'Set status message')"
:disabled="isSavingStatus">
{{ $t('user_status', 'Set status message') }}
</NcButton>
</div>
</form>
</div>
</NcModal>
</template>
@ -245,12 +246,7 @@ export default {
try {
this.isSavingStatus = true
if (this.messageId !== undefined && this.messageId !== null) {
await this.$store.dispatch('setPredefinedMessage', {
messageId: this.messageId,
clearAt: this.clearAt,
})
} else {
if (this.isCustomStatus) {
await this.$store.dispatch('setCustomMessage', {
message: this.editedMessage,
icon: this.icon,

@ -35,7 +35,7 @@ const mutations = {
* @param {object} status The status to add
*/
addPredefinedStatus(state, status) {
state.predefinedStatuses.push(status)
state.predefinedStatuses = [...state.predefinedStatuses, status]
},
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long