diff --git a/backend/user/serializers.py b/backend/user/serializers.py index be617437..2a8a6f47 100644 --- a/backend/user/serializers.py +++ b/backend/user/serializers.py @@ -38,7 +38,7 @@ class UserMeConfigSerializer(serializers.Serializer): view_style_downloads = serializers.ChoiceField(choices=["grid", "list"]) view_style_playlist = serializers.ChoiceField(choices=["grid", "list"]) grid_items = serializers.IntegerField(max_value=7, min_value=3) - hide_watched = serializers.BooleanField() + hide_watched = serializers.BooleanField(allow_null=True) file_size_unit = serializers.ChoiceField(choices=["binary", "metric"]) show_ignored_only = serializers.BooleanField() show_subed_only = serializers.BooleanField() diff --git a/backend/user/src/user_config.py b/backend/user/src/user_config.py index f691e980..c9861926 100644 --- a/backend/user/src/user_config.py +++ b/backend/user/src/user_config.py @@ -21,7 +21,7 @@ class UserConfigType(TypedDict, total=False): view_style_downloads: str view_style_playlist: str grid_items: int - hide_watched: bool + hide_watched: bool | None file_size_unit: str show_ignored_only: bool show_subed_only: bool diff --git a/backend/video/serializers.py b/backend/video/serializers.py index afd8b0b4..fe17da6c 100644 --- a/backend/video/serializers.py +++ b/backend/video/serializers.py @@ -112,7 +112,7 @@ class VideoListQuerySerializer(serializers.Serializer): playlist = serializers.CharField(required=False) channel = serializers.CharField(required=False) watch = serializers.ChoiceField( - choices=WatchedEnum.values(), required=False + choices=WatchedEnum.values(), required=False, allow_null=True ) sort = serializers.ChoiceField(choices=SortEnum.names(), required=False) order = serializers.ChoiceField(choices=OrderEnum.values(), required=False) diff --git a/backend/video/src/query_building.py b/backend/video/src/query_building.py index fe4bc0b7..84a4b955 100644 --- a/backend/video/src/query_building.py +++ b/backend/video/src/query_building.py @@ -35,7 +35,7 @@ class QueryBuilder: must_list.append({"match": {"playlist.keyword": playlist}}) watch = self.request_params.get("watch") - if watch: + if watch is not None: watch_must_list = self.parse_watch(watch) must_list.append(watch_must_list) diff --git a/frontend/src/api/actions/updateUserConfig.ts b/frontend/src/api/actions/updateUserConfig.ts index 9d2aac7a..038384fc 100644 --- a/frontend/src/api/actions/updateUserConfig.ts +++ b/frontend/src/api/actions/updateUserConfig.ts @@ -32,7 +32,7 @@ export type UserConfigType = { view_style_downloads: ViewStylesType; view_style_playlist: ViewStylesType; grid_items: number; - hide_watched: boolean; + hide_watched: boolean | null; file_size_unit: 'binary' | 'metric'; show_ignored_only: boolean; show_subed_only: boolean; diff --git a/frontend/src/api/loader/loadVideoListByPage.ts b/frontend/src/api/loader/loadVideoListByPage.ts index b7a4af93..1cf67155 100644 --- a/frontend/src/api/loader/loadVideoListByPage.ts +++ b/frontend/src/api/loader/loadVideoListByPage.ts @@ -36,7 +36,7 @@ export const SortOrderEnum = { export type VideoTypes = 'videos' | 'streams' | 'shorts'; -export type WatchTypes = 'watched' | 'unwatched' | 'continue'; +export type WatchTypes = 'watched' | 'unwatched' | 'continue' | null; export const WatchTypesEnum = { Watched: 'watched', Unwatched: 'unwatched', diff --git a/frontend/src/components/Filterbar.tsx b/frontend/src/components/Filterbar.tsx index 8219bea1..73b5a473 100644 --- a/frontend/src/components/Filterbar.tsx +++ b/frontend/src/components/Filterbar.tsx @@ -29,6 +29,8 @@ const Filterbar = ({ hideToggleText, viewStyle, showSort = true }: FilterbarProp const currentViewStyle = userConfig[viewStyle]; const isGridView = currentViewStyle === ViewStylesEnum.Grid; + console.log(hideToggleText); + useEffect(() => { if (!showSort) { return; @@ -52,7 +54,21 @@ const Filterbar = ({ hideToggleText, viewStyle, showSort = true }: FilterbarProp return (