albums: fix link-only titles

Signed-off-by: Varun Patil <radialapps@gmail.com>
pulsejet/aio-hw-docs
Varun Patil 2023-11-14 01:01:01 -08:00
parent 27f8608d69
commit 33571bf661
3 changed files with 16 additions and 3 deletions

View File

@ -79,13 +79,19 @@ class PublicAlbumController extends Controller
// Scripts // Scripts
Util::addScript(Application::APPNAME, 'memories-main'); Util::addScript(Application::APPNAME, 'memories-main');
// Get page title
$shareTitle = $album['name'];
if (str_starts_with($shareTitle, '.link-')) {
$shareTitle = $this->l10n->t('Shared Link');
}
// Share info // Share info
$this->initialState->provideInitialState('share_title', $album['name']); $this->initialState->provideInitialState('share_title', $shareTitle);
$this->initialState->provideInitialState('share_type', 'album'); $this->initialState->provideInitialState('share_type', 'album');
// Render main template // Render main template
$response = new PublicTemplateResponse(Application::APPNAME, 'main', PageController::getMainParams()); $response = new PublicTemplateResponse(Application::APPNAME, 'main', PageController::getMainParams());
$response->setHeaderTitle($album['name']); $response->setHeaderTitle($shareTitle);
$response->setFooterVisible(false); // wth is that anyway? $response->setFooterVisible(false); // wth is that anyway?
$response->setContentSecurityPolicy(PageController::getCSP()); $response->setContentSecurityPolicy(PageController::getCSP());

View File

@ -51,7 +51,7 @@ export default defineComponent({
viewName(): string { viewName(): string {
// Show album name for album view // Show album name for album view
if (this.routeIsAlbums) { if (this.routeIsAlbums) {
return this.$route.params.name || String(); return strings.albumDisplayName(this.$route.params.name ?? String());
} }
// Show share name for public shares, except for folder share, // Show share name for public shares, except for folder share,

View File

@ -55,3 +55,10 @@ export function viewName(routeName: string): string {
return String(); return String();
} }
} }
export function albumDisplayName(name: string): string {
if (name.startsWith('.link-')) {
return t('memories', 'Shared Link');
}
return name;
}