fix: asset type filter (#29190)

This commit is contained in:
Daniel Dietzler
2026-06-18 15:30:34 +02:00
committed by GitHub
parent 40cffcd414
commit 53fe26593c
4 changed files with 41 additions and 10 deletions
+8 -8
View File
@@ -184,22 +184,22 @@
"uiHints": ["Filter"]
},
{
"name": "filterFileType",
"title": "Filter by file type",
"description": "Filter assets by file type",
"name": "assetTypeFilter",
"title": "Filter by asset type",
"description": "Filter assets by type",
"types": ["AssetV1"],
"schema": {
"type": "object",
"properties": {
"fileTypes": {
"title": "File types",
"description": "Allowed file types",
"allowedTypes": {
"title": "Asset types",
"description": "Allowed asset types",
"type": "string",
"array": true,
"enum": ["image", "video"]
"enum": ["IMAGE", "VIDEO", "AUDIO", "OTHER"]
}
},
"required": ["fileTypes"]
"required": ["types"]
},
"uiHints": ["Filter"]
},
+1
View File
@@ -14,6 +14,7 @@ declare module 'main' {
export function assetFileFilter(): I32;
export function assetMissingTimeZoneFilter(): I32;
export function assetLocationFilter(): I32;
export function assetTypeFilter(): I32;
// updates
export function assetFavorite(): I32;
+7 -1
View File
@@ -1,5 +1,5 @@
import { wrapper } from '@immich/plugin-sdk';
import { AssetVisibility, WorkflowType } from '@immich/sdk';
import { AssetTypeEnum, AssetVisibility, WorkflowType } from '@immich/sdk';
type AssetFileFilterConfig = {
pattern: string;
@@ -95,6 +95,12 @@ export const assetLocationFilter = () => {
});
};
export const assetTypeFilter = () => {
return wrapper<WorkflowType.AssetV1, { allowedTypes: AssetTypeEnum[] }>(({ config, data }) => {
return { workflow: { continue: config.allowedTypes.includes(data.asset.type) } };
});
};
export const assetFavorite = () => {
return wrapper<WorkflowType.AssetV1, { inverse?: boolean }>(({ config, data }) => {
const target = config.inverse ? false : true;