Skip to content

Commit

Permalink
Remove album folder in day call
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed Oct 29, 2022
1 parent 80f6a49 commit 7dd758e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
27 changes: 17 additions & 10 deletions lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public function days(): JSONResponse
{
// Get the folder to show
$uid = $this->getUid();

// Get the folder to show
$folder = null;

try {
Expand All @@ -97,15 +99,10 @@ public function days(): JSONResponse
return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_NOT_FOUND);
}

// Params
$recursive = null === $this->request->getParam('folder');
$archive = null !== $this->request->getParam('archive');

// Remove folder if album
// Permissions will be checked during the transform
if ($this->request->getParam('album')) {
$folder = null;
}

// Run actual query
try {
$list = $this->timelineQuery->getDays(
Expand Down Expand Up @@ -172,12 +169,17 @@ public function day(string $id): JSONResponse
}

// Get the folder to show
$folder = $this->getRequestFolder();
$folder = null;

try {
$folder = $this->getRequestFolder();
} catch (\Exception $e) {
return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_NOT_FOUND);
}

// Params
$recursive = null === $this->request->getParam('folder');
$archive = null !== $this->request->getParam('archive');
if (null === $folder) {
return new JSONResponse([], Http::STATUS_NOT_FOUND);
}

// Run actual query
try {
Expand Down Expand Up @@ -825,6 +827,11 @@ private function preloadDays(array &$days, string $uid, &$folder, bool $recursiv
/** Get the Folder object relevant to the request */
private function getRequestFolder()
{
// Albums have no folder
if ($this->request->getParam('album')) {
return null;
}

// Public shared folder
if ($token = $this->getShareToken()) {
$share = $this->shareManager->getShareByToken($token)->getNode(); // throws exception if not found
Expand Down
1 change: 0 additions & 1 deletion src/components/Timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,6 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
"album",
`${this.$route.params.user}/${this.$route.params.name}`
);
query.set("fields", "basename,mimetype");
}
// Favorites
Expand Down

0 comments on commit 7dd758e

Please sign in to comment.