From dc86f0b7aa5b18c15bb4a4a41af3c77868cd0965 Mon Sep 17 00:00:00 2001 From: Ostap Zherebetskyi Date: Tue, 30 Dec 2025 12:00:33 +0200 Subject: [PATCH] Check for the switch only during the post-migration process --- osf/management/commands/populate_notification_types.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osf/management/commands/populate_notification_types.py b/osf/management/commands/populate_notification_types.py index 441f084bd07..302c1069a17 100644 --- a/osf/management/commands/populate_notification_types.py +++ b/osf/management/commands/populate_notification_types.py @@ -20,10 +20,11 @@ } def populate_notification_types(*args, **kwargs): - if not switch_is_active(features.POPULATE_NOTIFICATION_TYPES): - if 'pytest' not in sys.modules: - logger.info('POPULATE_NOTIFICATION_TYPES switch is off; skipping population of notification types.') - return + if kwargs.get('sender'): # exists when called as a post_migrate signal + if not switch_is_active(features.POPULATE_NOTIFICATION_TYPES): + if 'pytest' not in sys.modules: + logger.info('POPULATE_NOTIFICATION_TYPES switch is off; skipping population of notification types.') + return logger.info('Populating notification types...') from django.contrib.contenttypes.models import ContentType from osf.models.notification_type import NotificationType