albums: hide hidden from list
Signed-off-by: Varun Patil <radialapps@gmail.com>pulsejet/aio-hw-docs
parent
016991d40e
commit
27f8608d69
|
@ -116,6 +116,7 @@ class OtherController extends GenericApiController
|
|||
|
||||
// album settings
|
||||
'sort_album_month' => 'true' === $getAppConfig('sortAlbumMonth', 'true'),
|
||||
'show_hidden_albums' => 'true' === $getAppConfig('showHiddenAlbums', false),
|
||||
], Http::STATUS_OK);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ export default defineComponent({
|
|||
await this.refs.dtm?.refresh?.();
|
||||
|
||||
if (this.routeIsAlbums) {
|
||||
this.items = await dav.getAlbums(this.config.album_list_sort);
|
||||
this.items = await dav.getAlbums();
|
||||
} else if (this.routeIsTags) {
|
||||
this.items = await dav.getTags();
|
||||
} else if (this.routeIsRecognize) {
|
||||
|
|
|
@ -153,6 +153,14 @@
|
|||
>
|
||||
{{ t('memories', 'Sort albums oldest-first') }}
|
||||
</NcCheckboxRadioSwitch>
|
||||
|
||||
<NcCheckboxRadioSwitch
|
||||
:checked.sync="config.show_hidden_albums"
|
||||
@update:checked="updateShowHidden"
|
||||
type="switch"
|
||||
>
|
||||
{{ t('memories', 'Show hidden albums') }}
|
||||
</NcCheckboxRadioSwitch>
|
||||
</NcAppSettingsSection>
|
||||
</NcAppSettingsDialog>
|
||||
|
||||
|
@ -315,6 +323,7 @@ export default defineComponent({
|
|||
// Folders settings
|
||||
async updateShowHidden() {
|
||||
await this.updateSetting('show_hidden_folders', 'showHidden');
|
||||
await this.updateSetting('show_hidden_albums', 'showHiddenAlbums');
|
||||
},
|
||||
|
||||
async updateSortFolderMonth() {
|
||||
|
|
|
@ -193,7 +193,7 @@ export default defineComponent({
|
|||
// if only one photo is selected, get the albums of that photo
|
||||
const fileid = this.photos.length === 1 ? this.photos[0].fileid : 0;
|
||||
if (fileid) {
|
||||
const selIds = new Set((await dav.getAlbums(1, fileid)).map((a) => a.album_id));
|
||||
const selIds = new Set((await dav.getAlbums(fileid)).map((a) => a.album_id));
|
||||
this.initSelection = new Set(this.albums.filter((a) => selIds.has(a.album_id)));
|
||||
this.selection = new Set(this.initSelection);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ export default defineComponent({
|
|||
|
||||
linkTarget(album: IAlbum) {
|
||||
return {
|
||||
name: 'albums',
|
||||
name: _m.routes.Albums.name,
|
||||
params: {
|
||||
name: album.name,
|
||||
user: album.user,
|
||||
|
|
|
@ -7,6 +7,7 @@ import { getLanguage } from '@nextcloud/l10n';
|
|||
import { translate as t } from '@services/l10n';
|
||||
import { API } from '@services/API';
|
||||
import client from '@services/dav/client';
|
||||
import staticConfig from '@services/static-config';
|
||||
import * as utils from '@services/utils';
|
||||
|
||||
import type { IAlbum, IFileInfo, IPhoto } from '@typings';
|
||||
|
@ -25,19 +26,24 @@ export function getAlbumPath(user: string, name: string) {
|
|||
|
||||
/**
|
||||
* Get list of albums.
|
||||
* @param sort Sort order; 1 = by date, 2 = by name
|
||||
* @param fileid Optional file ID to get albums for
|
||||
*/
|
||||
export async function getAlbums(sort: 1 | 2 = 1, fileid?: number) {
|
||||
export async function getAlbums(fileid?: number) {
|
||||
const url = API.Q(API.ALBUM_LIST(), { fileid });
|
||||
const res = await axios.get<IAlbum[]>(url);
|
||||
const data = res.data;
|
||||
let data = res.data;
|
||||
|
||||
// Remove hidden albums unless specified
|
||||
if (!(await staticConfig.get('show_hidden_albums'))) {
|
||||
data = data.filter((a) => !a.name.startsWith('.'));
|
||||
}
|
||||
|
||||
// Sort the response
|
||||
switch (sort) {
|
||||
switch (await staticConfig.get('album_list_sort')) {
|
||||
case 2:
|
||||
data.sort((a, b) => a.name.localeCompare(b.name, getLanguage(), { numeric: true }));
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
data.sort((a, b) => b.created - a.created);
|
||||
}
|
||||
|
|
|
@ -135,6 +135,7 @@ class StaticConfig {
|
|||
|
||||
// album settings
|
||||
sort_album_month: true,
|
||||
show_hidden_albums: false,
|
||||
|
||||
// local settings
|
||||
square_thumbs: false,
|
||||
|
|
|
@ -34,6 +34,7 @@ declare module '@typings' {
|
|||
|
||||
// album settings
|
||||
sort_album_month: boolean;
|
||||
show_hidden_albums: boolean;
|
||||
|
||||
// local settings
|
||||
square_thumbs: boolean;
|
||||
|
|
Loading…
Reference in New Issue