Default VOD categories to disabled.

This commit is contained in:
SergeantPanda 2025-08-28 13:17:22 -05:00
parent ad774db59e
commit 2026eab7f2
3 changed files with 10 additions and 9 deletions

View file

@ -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)),

View file

@ -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.")

View file

@ -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(