Skip to content

Commit

Permalink
fix(dav): Use IUser::getDisplayName directly
Browse files Browse the repository at this point in the history
No need to send this from the client.

Signed-off-by: Christoph Wurst <[email protected]>
Signed-off-by: nextcloud-command <[email protected]>
  • Loading branch information
ChristophWurst authored and nextcloud-command committed Mar 5, 2025
1 parent 60821a7 commit 9c35a02
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
6 changes: 2 additions & 4 deletions apps/dav/lib/Controller/OutOfOfficeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public function getOutOfOffice(string $userId): DataResponse {
* @param string $status Short text that is set as user status during the absence
* @param string $message Longer multiline message that is shown to others during the absence
* @param ?string $replacementUserId User id of the replacement user
* @param ?string $replacementUserDisplayName Display name of the replacement user
* @return DataResponse<Http::STATUS_OK, DAVOutOfOfficeData, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array{error: 'firstDay'}, array{}>|DataResponse<Http::STATUS_UNAUTHORIZED, null, array{}>|DataResponse<Http::STATUS_NOT_FOUND, null, array{}>
*
* 200: Absence data
Expand All @@ -121,14 +120,13 @@ public function setOutOfOffice(
string $status,
string $message,
?string $replacementUserId,
?string $replacementUserDisplayName

): DataResponse {
$user = $this->userSession?->getUser();
if ($user === null) {
return new DataResponse(null, Http::STATUS_UNAUTHORIZED);
}

$replacementUser = null;
if ($replacementUserId !== null) {
$replacementUser = $this->userManager->get($replacementUserId);
if ($replacementUser === null) {
Expand All @@ -149,7 +147,7 @@ public function setOutOfOffice(
$status,
$message,
$replacementUserId,
$replacementUserDisplayName
$replacementUser?->getDisplayName()
);
$this->coordinator->clearCache($user->getUID());

Expand Down
5 changes: 0 additions & 5 deletions apps/dav/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,6 @@
"type": "string",
"nullable": true,
"description": "User id of the replacement user"
},
"replacementUserDisplayName": {
"type": "string",
"nullable": true,
"description": "Display name of the replacement user"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion apps/dav/src/components/AbsenceForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ export default {
status: this.status,
message: this.message,
replacementUserId: this.replacementUser?.user ?? null,
replacementUserDisplayName: this.replacementUser?.displayName ?? null,
})
showSuccess(this.$t('dav', 'Absence saved'))
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions dist/dav-settings-personal-availability.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dav-settings-personal-availability.js.map

Large diffs are not rendered by default.

0 comments on commit 9c35a02

Please sign in to comment.