Skip to content

Commit

Permalink
Fix the remaining bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlSchwan committed Nov 4, 2021
1 parent e711fcb commit b294de2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
10 changes: 1 addition & 9 deletions apps/user_status/lib/Service/StatusService.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,15 +454,7 @@ public function revertUserStatus(string $userId, ?string $messageId, string $sta
/** @var UserStatus $userStatus */
$backupUserStatus = $this->mapper->findByUserId($userId, true);
} catch (DoesNotExistException $ex) {
// No backup, just move back to available
try {
$userStatus = $this->mapper->findByUserId($userId);
} catch (DoesNotExistException $ex) {
// No backup nor current status => ignore
return;
}
$this->cleanStatus($userStatus);
$this->cleanStatusMessage($userStatus);
// No user status to revert, do nothing
return;
}
try {
Expand Down
10 changes: 9 additions & 1 deletion apps/user_status/src/components/SetStatusModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export default {
time: this.$store.state.userStatus.clearAt,
}
}
subscribe('user_status:status.updated', this.handleUserStatusUpdated)
},
methods: {
/**
Expand Down Expand Up @@ -182,6 +183,13 @@ export default {
this.icon = status.icon
this.message = status.message
},
handleUserStatusUpdated(state) {
if (OC.getCurrentUser().uid === state.userId) {
this.messageId = this.$store.state.userStatus.messageId
this.icon = this.$store.state.userStatus.icon
this.message = this.$store.state.userStatus.message || ''
}
},
/**
* Saves the status and closes the
*
Expand Down Expand Up @@ -245,7 +253,7 @@ export default {
min-height: 200px;
padding: 8px 20px 20px 20px;
// Enable scrollbar for too long content, same way as in Dashboard customize
max-height: 75vh;
max-height: 80vh;
overflow: auto;
&__header {
Expand Down
7 changes: 7 additions & 0 deletions apps/user_status/src/store/userStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ const actions = {
await revertStatus(status)
commit('loadStatusFromServer', backupStatus)
dispatch('loadBackupStatus')
emit('user_status:status.updated', {
status: state.status,
message: state.message,
icon: state.icon,
clearAt: state.clearAt,
userId: getCurrentUser()?.uid,
})
},

/**
Expand Down

0 comments on commit b294de2

Please sign in to comment.