From 2026eab7f2f576d91e545d91492471f1752d92af Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Thu, 28 Aug 2025 13:17:22 -0500 Subject: [PATCH] Default VOD categories to disabled. --- apps/vod/migrations/0001_initial.py | 4 ++-- apps/vod/models.py | 2 +- frontend/src/components/forms/VODCategoryFilter.jsx | 13 +++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/vod/migrations/0001_initial.py b/apps/vod/migrations/0001_initial.py index c6edf9de..02c6ae2a 100644 --- a/apps/vod/migrations/0001_initial.py +++ b/apps/vod/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.2.4 on 2025-08-28 14:46 +# Generated by Django 5.2.4 on 2025-08-28 18:16 import django.db.models.deletion import uuid @@ -107,7 +107,7 @@ class Migration(migrations.Migration): name='M3UVODCategoryRelation', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('enabled', models.BooleanField(default=True, help_text='Set to false to deactivate this category for the M3U account')), + ('enabled', models.BooleanField(default=False, help_text='Set to false to deactivate this category for the M3U account')), ('custom_properties', models.JSONField(blank=True, help_text='Provider-specific data like quality, language, etc.', null=True)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), diff --git a/apps/vod/models.py b/apps/vod/models.py index 0e799144..5e73bc5d 100644 --- a/apps/vod/models.py +++ b/apps/vod/models.py @@ -285,7 +285,7 @@ class M3UVODCategoryRelation(models.Model): category = models.ForeignKey(VODCategory, on_delete=models.CASCADE, related_name='m3u_relations') enabled = models.BooleanField( - default=True, help_text="Set to false to deactivate this category for the M3U account" + default=False, help_text="Set to false to deactivate this category for the M3U account" ) custom_properties = models.JSONField(blank=True, null=True, help_text="Provider-specific data like quality, language, etc.") diff --git a/frontend/src/components/forms/VODCategoryFilter.jsx b/frontend/src/components/forms/VODCategoryFilter.jsx index 5d744785..7b922f06 100644 --- a/frontend/src/components/forms/VODCategoryFilter.jsx +++ b/frontend/src/components/forms/VODCategoryFilter.jsx @@ -21,7 +21,6 @@ const VODCategoryFilter = ({ type, }) => { const categories = useVODStore((s) => s.categories); - const [isLoading, setIsLoading] = useState(false); const [filter, setFilter] = useState(''); useEffect(() => { @@ -29,12 +28,14 @@ const VODCategoryFilter = ({ return; } - console.log(categories) + console.log(categories); setCategoryStates( Object.values(categories) - .filter((cat) => - cat.m3u_accounts.find((acc) => acc.m3u_account == playlist.id) && cat.category_type == type + .filter( + (cat) => + cat.m3u_accounts.find((acc) => acc.m3u_account == playlist.id) && + cat.category_type == type ) .map((cat) => { const match = cat.m3u_accounts.find( @@ -43,13 +44,13 @@ const VODCategoryFilter = ({ if (match) { return { ...cat, - enabled: match.enabled, + enabled: match.enabled || false, // Keep user's previous choice, default to false for new categories original_enabled: match.enabled, }; } }) ); - }, [categories]); + }, [categories, playlist.id, setCategoryStates, type]); const toggleEnabled = (id) => { setCategoryStates(