Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(files_sharing): Open single-file-share by default #47841

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public function renderPage(IShare $share, string $token, string $path): Template
$view = 'public-share';
if ($shareNode instanceof File) {
$view = 'public-file-share';
$this->initialState->provideInitialState('fileId', $shareNode->getId());
} elseif (($share->getPermissions() & \OCP\Constants::PERMISSION_CREATE)
&& !($share->getPermissions() & \OCP\Constants::PERMISSION_READ)
) {
Expand Down
11 changes: 11 additions & 0 deletions apps/files_sharing/src/init-public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,14 @@ navigation.setActive(navigation.views.find(({ id }) => id === view) ?? null)
// Force our own router
window.OCP.Files = window.OCP.Files ?? {}
window.OCP.Files.Router = new RouterService(router)

// If this is a single file share, so set the fileid as active in the URL
const fileId = loadState<number|null>('files_sharing', 'fileId', null)
const token = loadState<string>('files_sharing', 'sharingToken')
if (fileId !== null) {
window.OCP.Files.Router.goToRoute(
'filelist',
{ ...window.OCP.Files.Router.params, token, fileid: String(fileId) },
{ ...window.OCP.Files.Router.query, openfile: 'true' },
)
}
4 changes: 2 additions & 2 deletions dist/files_sharing-init-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-init-public.js.map

Large diffs are not rendered by default.

Loading