Skip to content

Commit

Permalink
fix get tags when directeditor(Fix #503)
Browse files Browse the repository at this point in the history
  • Loading branch information
Antipkin-A committed Aug 3, 2021
1 parent d751c5e commit 11340bd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok
}

if (!$template) {
$params["document"]["info"]["favorite"] = $this->isFavorite($fileId);
$params["document"]["info"]["favorite"] = $this->isFavorite($fileId, $userId);
}
$params["_file_path"] = $userFolder->getRelativePath($file->getPath());
}
Expand Down Expand Up @@ -1631,11 +1631,12 @@ private function getWatermarkText($isPublic, $userId, $file, $canEdit, $canDownl
* Check file favorite
*
* @param integer $fileId - file identifier
* @param string $userId - user identifier
*
* @return bool
*/
private function isFavorite($fileId) {
$currentTags = $this->tagManager->load("files")->getTagsForObjects([$fileId]);
private function isFavorite($fileId, $userId = null) {
$currentTags = $this->tagManager->load("files", [], false, $userId)->getTagsForObjects([$fileId]);
if ($currentTags) {
return in_array(ITags::TAG_FAVORITE, $currentTags[$fileId]);
}
Expand Down

0 comments on commit 11340bd

Please sign in to comment.