Skip to content

Commit

Permalink
Merge pull request #39055 from nextcloud/backport/38832/stable27
Browse files Browse the repository at this point in the history
[stable27] Adjust saving of status messages
  • Loading branch information
Antreesy authored Jul 3, 2023
2 parents 5fd29c6 + d8141c6 commit 8cad04d
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 60 deletions.
10 changes: 2 additions & 8 deletions apps/user_status/src/components/CustomMessageInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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) {
Expand Down
86 changes: 41 additions & 45 deletions apps/user_status/src/components/SetStatusModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion apps/user_status/src/store/predefinedStatuses.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
},
}

Expand Down
4 changes: 2 additions & 2 deletions dist/user-status-modal-8299.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/user-status-modal-8299.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.

0 comments on commit 8cad04d

Please sign in to comment.