Skip to content

Commit

Permalink
Merge pull request 'fix: unknown author for last version' from hotfix…
Browse files Browse the repository at this point in the history
…/unknown-author-last-version into develop

Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/onlyoffice-nextcloud/pulls/39
  • Loading branch information
LinneyS committed Feb 12, 2025
2 parents f0ae6fa + cfa22c9 commit 1978fa9
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions lib/Controller/EditorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -993,18 +993,25 @@ public function history($fileId) {
$versionId = $file->getFileInfo()->getMtime();

$author = FileVersions::getAuthor($ownerId, $file->getFileInfo(), $versionId);
if (!empty($this->config->getUnknownAuthor()) && $versionNum !== 1) {
$authorName = $this->config->getUnknownAuthor();
if ($author !== null) {
$historyItem["user"] = [
"name" => $authorName,
"id" => $this->buildUserId($author["id"]),
"name" => $author["name"],
];
} else {
$authorName = $owner->getDisplayName();
$authorId = $owner->getUID();
$historyItem["user"] = [
"id" => $this->buildUserId($authorId),
"name" => $authorName,
];
if (!empty($this->config->getUnknownAuthor()) && $versionNum !== 0) {
$authorName = $this->config->getUnknownAuthor();
$historyItem["user"] = [
"name" => $authorName,
];
} else {
$authorName = $owner->getDisplayName();
$authorId = $owner->getUID();
$historyItem["user"] = [
"id" => $this->buildUserId($authorId),
"name" => $authorName,
];
}
}

$historyData = FileVersions::getHistoryData($ownerId, $file->getFileInfo(), $versionId, $prevVersion);
Expand Down

0 comments on commit 1978fa9

Please sign in to comment.