Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
62af777
Create global_file_updated and global_reviews subscriptions if missing
cslzchen Jan 19, 2026
3093f88
Add missing `is_digest=True` for new OSF user subscriptions
cslzchen Jan 20, 2026
f23108b
Extend otf subscription creation to apply to _node_file_updated group
cslzchen Jan 20, 2026
abdfc1b
Fix typo for `_is_digest`
cslzchen Jan 20, 2026
ae98b96
add is_digest_type property
Ostap-Zherebetskyi Jan 20, 2026
73d87ca
Add is_digest_type property to NotificationType and log message in em…
Ostap-Zherebetskyi Jan 20, 2026
d302576
Fix is_digest handling in NotificationType.emit method
Ostap-Zherebetskyi Jan 20, 2026
a6c9576
Log message update in NotificationType.emit method for is_digest hand…
Ostap-Zherebetskyi Jan 20, 2026
bc3f05f
fix unit tests
Ostap-Zherebetskyi Jan 20, 2026
daaa834
fix unit tests
Ostap-Zherebetskyi Jan 20, 2026
807f652
fix unit tests
Ostap-Zherebetskyi Jan 20, 2026
e7f7216
Move set-deafult-subscriptions out of non-effective try-except
cslzchen Jan 21, 2026
f0b7056
Add fake_sent field to Notification model and update notification cre…
Ostap-Zherebetskyi Jan 8, 2026
ce14838
add unique_together constraint
Ostap-Zherebetskyi Jan 8, 2026
0e3f9bc
Add 'PARTIAL_SUCCESS' status to EmailTask model and update email task…
Ostap-Zherebetskyi Jan 8, 2026
e90bb1c
NR migration [ENG-10040, ENG-10025, ENG-9854]
Ostap-Zherebetskyi Jan 8, 2026
08e1ea2
Remove subscription if notifications.tasks.send_moderator_email_task …
Ostap-Zherebetskyi Jan 8, 2026
ab06f57
Apply suggestion from @Ostap-Zherebetskyi remove datetime
Ostap-Zherebetskyi Jan 19, 2026
ced4078
Merge pull request #11558 from Ostap-Zherebetskyi/feature/digest_types
cslzchen Jan 21, 2026
c0f944f
Add 'no_login_email_last_sent' field to OSFUser and update email task…
Ostap-Zherebetskyi Jan 22, 2026
b86793e
Enforce and improve permission check for subscriptions
cslzchen Jan 23, 2026
5d78491
Fix typo in annotated_obj_qs for NODE_FILE_UPDATED
cslzchen Jan 23, 2026
20d8cb6
Add unit tests for testing node_file_updated subscription detail
cslzchen Jan 23, 2026
8f51b4a
Implement notifications cleanup task and related settings; add tests …
Ostap-Zherebetskyi Jan 23, 2026
1ede6f2
Fix legacy subscription ID for NODE_FILE_UPDATED: "guid_files_updated"
cslzchen Jan 23, 2026
fa8ebfb
Fix duplicate and mismatched type NODE_FILE(S)_UPDATED
cslzchen Jan 23, 2026
7f475ab
removed email.py
bodintsov Jan 26, 2026
3996aad
Fix annotated qs for global reviews and update unit tests
cslzchen Jan 27, 2026
46128e7
Update tests for node_file(s)_updated subscription detail
cslzchen Jan 27, 2026
75e6038
Rename fixtures for notification subscription detail tests
cslzchen Jan 27, 2026
00b9f08
Annotate with legacy_id for serializer to handle created subscriptions
cslzchen Jan 27, 2026
5673ead
Add unit tests for creating missing subscriptions on the fly
cslzchen Jan 27, 2026
8687a5a
clear useless code
bodintsov Jan 27, 2026
d668c6b
clear useless code
bodintsov Jan 27, 2026
cd80036
Rename migration name for NR post-release
cslzchen Jan 27, 2026
6bc138c
Improve unit test: test_emit_frequency_none
cslzchen Jan 27, 2026
09a570d
Remove `seen` from `Notification` and re-make migrations
cslzchen Jan 27, 2026
c5fa8bc
`mark_sent()` now handles `fake_sent=True`, and only `save()` once
cslzchen Jan 27, 2026
f857791
Update default settings
Ostap-Zherebetskyi Jan 28, 2026
25c2637
remove useless import
bodintsov Jan 28, 2026
f6694d8
Merge pull request #11540 from Ostap-Zherebetskyi/hotfix/NR_model_mig…
cslzchen Jan 28, 2026
b864ef1
Merge pull request #11562 from Ostap-Zherebetskyi/feature/notificatio…
cslzchen Jan 28, 2026
132cd8d
Enhance SubscriptionList queryset with additional content types and r…
Ostap-Zherebetskyi Jan 27, 2026
6999f4f
fix unit test
Ostap-Zherebetskyi Jan 27, 2026
b925732
Refactor SubscriptionList queryset to use a single provider content t…
Ostap-Zherebetskyi Jan 28, 2026
5785107
fix CR comments
Ostap-Zherebetskyi Jan 28, 2026
ccfeda1
Merge pull request #11564 from Ostap-Zherebetskyi/fix/SubscriptionLis…
cslzchen Jan 28, 2026
f5b0202
Update comments
cslzchen Jan 28, 2026
3adf193
Merge pull request #11565 from bodintsov/fix/remove-deprecated-code
cslzchen Jan 28, 2026
7371ed3
split into 3 files
bodintsov Jan 15, 2026
35737a7
remove populate_notification_subscriptions
bodintsov Jan 15, 2026
cc7fc29
Renamed files, refactor of populate notification subscriptions user g…
bodintsov Jan 20, 2026
5fef52a
added try/except, added timers
bodintsov Jan 20, 2026
93d98db
converted populate_notification_subscriptions_user_global_reviews.py
bodintsov Jan 21, 2026
7f8f705
fix batch time execution
bodintsov Jan 22, 2026
e38048b
converted populate_notification_subscriptions_node_file_updated
bodintsov Jan 23, 2026
434160f
convert to separate update and create scripts
bodintsov Jan 23, 2026
f2c5667
updated, added parameters
bodintsov Jan 27, 2026
f89e0b3
move to remove_after_use
bodintsov Jan 28, 2026
38a07fe
add time track to last batch, fix proper time track for batch in node…
bodintsov Jan 30, 2026
799bedb
convert to use review_nt
bodintsov Jan 30, 2026
e20ae56
Merge branch 'feature/notifications-refactor-post-release' into featu…
cslzchen Feb 3, 2026
b2c6a72
Fix unit tests due to new constraints
cslzchen Feb 3, 2026
8d9658f
Move missing subscription creation to a helper function in utils
cslzchen Feb 3, 2026
ad18043
Subscription list view now creates missing attributes on-the-fly
cslzchen Feb 3, 2026
7bf6b2a
Fix broken `.exists()` due to complex annotated QS with `.distinct()`
cslzchen Feb 3, 2026
c9cffee
fix names of tasks
bodintsov Feb 3, 2026
00702ef
Merge pull request #11560 from bodintsov/feature/optimize-subscriptio…
cslzchen Feb 3, 2026
988aa13
Add notification subscriptions de-duplication v2 command
cslzchen Feb 3, 2026
b0f6450
fix naming
bodintsov Jan 12, 2026
830e6c7
Add deduplication command to notification migration
Ostap-Zherebetskyi Feb 6, 2026
6a342ae
Fix notification handling by updating legacy ID suffix from '_files_u…
Ostap-Zherebetskyi Feb 4, 2026
3b65361
fix unit tests
Ostap-Zherebetskyi Feb 4, 2026
b7b6b1b
Update the name of the NotificationType NODE_FILE_UPDATED to be consi…
Ostap-Zherebetskyi Feb 4, 2026
ba026e7
Rename notification type from node_files_updated to node_file_updated…
Ostap-Zherebetskyi Feb 10, 2026
752545e
clen keys
bodintsov Feb 9, 2026
7dca71b
fix naming in templates, event_context
bodintsov Feb 10, 2026
a158443
Merge remote-tracking branch 'upstream/develop' into feature/NR_post-…
Ostap-Zherebetskyi Feb 11, 2026
72f2993
fix naming in templates, event_context
bodintsov Feb 11, 2026
067c8f1
Merge pull request #11585 from Ostap-Zherebetskyi/feature/NR_post-rel…
cslzchen Feb 11, 2026
b7b3243
remove leftover comments
Ostap-Zherebetskyi Feb 11, 2026
da90148
Merge pull request #11581 from Ostap-Zherebetskyi/feature/deduplicati…
cslzchen Feb 11, 2026
f87fdad
Merge pull request #11556 from cslzchen/feature/create-missing-subscr…
cslzchen Feb 12, 2026
6ec5599
Merge pull request #11546 from bodintsov/fix/unify-keys-in-email-temp…
cslzchen Feb 12, 2026
b863e49
Refactor notification type references to use NotificationTypeEnum
Ostap-Zherebetskyi Dec 5, 2025
1d623e1
Fix notification type reference for FILE_UPDATED
Ostap-Zherebetskyi Jan 2, 2026
dfb2019
Refactor notification type references to use NotificationTypeEnum acr…
Ostap-Zherebetskyi Feb 3, 2026
06c5b3f
Refactor notification type references to use NotificationTypeEnum
Ostap-Zherebetskyi Feb 12, 2026
e4079a0
Refactor notification type references to use NotificationTypeEnum
Ostap-Zherebetskyi Feb 12, 2026
84d0cc9
fix unit tests
Ostap-Zherebetskyi Feb 12, 2026
1c089a2
Merge pull request #11520 from Ostap-Zherebetskyi/fix/consolidate_not…
cslzchen Feb 13, 2026
7507b58
remove imports
bodintsov Feb 17, 2026
b374927
Merge pull request #11595 from bodintsov/fix/fix-inproper-imports
Ostap-Zherebetskyi Feb 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions addons/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
DraftRegistration,
Guid,
FileVersionUserMetadata,
FileVersion, NotificationType
FileVersion, NotificationTypeEnum
)
from osf.metrics import PreprintView, PreprintDownload
from osf.utils import permissions
Expand Down Expand Up @@ -575,14 +575,13 @@ def create_waterbutler_log(payload, **kwargs):

if payload.get('email') or payload.get('errors'):
if payload.get('email'):
notification_type = NotificationType.Type.USER_FILE_OPERATION_SUCCESS.instance
notification_type = NotificationTypeEnum.USER_FILE_OPERATION_SUCCESS.instance
if payload.get('errors'):
notification_type = NotificationType.Type.USER_FILE_OPERATION_FAILED.instance
notification_type = NotificationTypeEnum.USER_FILE_OPERATION_FAILED.instance
notification_type.emit(
user=user,
subscribed_object=node,
event_context={
'user_fullname': user.fullname,
'action': payload['action'],
'source_node': source_node._id,
'source_node_title': source_node.title,
Expand Down
10 changes: 3 additions & 7 deletions addons/boa/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from addons.boa.boa_error_code import BoaErrorCode
from framework import sentry
from framework.celery_tasks import app as celery_app
from osf.models import OSFUser, NotificationType
from osf.models import OSFUser, NotificationTypeEnum
from osf.utils.fields import ensure_str, ensure_bytes
from website import settings as osf_settings

Expand Down Expand Up @@ -183,18 +183,15 @@ async def submit_to_boa_async(host, username, password, user_guid, project_guid,

logger.info('Successfully uploaded query output to OSF.')
logger.debug('Task ends <<<<<<<<')
NotificationType.Type.ADDONS_BOA_JOB_COMPLETE.instance.emit(
NotificationTypeEnum.ADDONS_BOA_JOB_COMPLETE.instance.emit(
user=user,
event_context={
'user_fullname': user.fullname,
'query_file_name': query_file_name,
'query_file_full_path': file_full_path,
'output_file_name': output_file_name,
'job_id': boa_job.id,
'project_url': project_url,
'boa_job_list_url': boa_settings.BOA_JOB_LIST_URL,
'boa_support_email': boa_settings.BOA_SUPPORT_EMAIL,
'osf_support_email': osf_settings.OSF_SUPPORT_EMAIL,
}
)
return BoaErrorCode.NO_ERROR
Expand All @@ -209,12 +206,11 @@ def handle_boa_error(message, code, username, fullname, project_url, query_file_
sentry.log_message(message, skip_session=True)
except Exception:
pass
NotificationType.Type.ADDONS_BOA_JOB_FAILURE.instance.emit(
NotificationTypeEnum.ADDONS_BOA_JOB_FAILURE.instance.emit(
destination_address=username,
event_context={
'user_fullname': fullname,
'code': code,
'query_file_name': query_file_name,
'file_size': file_size,
'message': message,
'max_file_size': boa_settings.MAX_SUBMISSION_SIZE,
Expand Down
4 changes: 2 additions & 2 deletions addons/boa/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from addons.boa import settings as boa_settings
from addons.boa.boa_error_code import BoaErrorCode
from addons.boa.tasks import submit_to_boa, submit_to_boa_async, handle_boa_error
from osf.models import NotificationType
from osf.models import NotificationTypeEnum
from osf_tests.factories import AuthUserFactory, ProjectFactory
from tests.base import OsfTestCase
from tests.utils import capture_notifications
Expand Down Expand Up @@ -66,7 +66,7 @@ def test_handle_boa_error(self):
job_id=self.job_id
)
assert len(notifications['emits']) == 1
assert notifications['emits'][0]['type'] == NotificationType.Type.ADDONS_BOA_JOB_FAILURE
assert notifications['emits'][0]['type'] == NotificationTypeEnum.ADDONS_BOA_JOB_FAILURE
mock_sentry_log_message.assert_called_with(self.error_message, skip_session=True)
mock_logger_error.assert_called_with(self.error_message)
assert return_value == BoaErrorCode.UNKNOWN
Expand Down
4 changes: 2 additions & 2 deletions addons/osfstorage/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from framework.auth import Auth
from addons.osfstorage.models import OsfStorageFile, OsfStorageFileNode, OsfStorageFolder
from osf.models import BaseFileNode, NotificationType
from osf.models import BaseFileNode, NotificationTypeEnum
from osf.exceptions import ValidationError
from osf.utils.permissions import WRITE, ADMIN

Expand Down Expand Up @@ -750,7 +750,7 @@ def test_after_fork_copies_versions(self, node, node_settings, auth_obj):
fork = node.fork_node(auth_obj)

assert len(notifications['emits']) == 1
assert notifications['emits'][0]['type'] == NotificationType.Type.NODE_CONTRIBUTOR_ADDED_DEFAULT
assert notifications['emits'][0]['type'] == NotificationTypeEnum.NODE_CONTRIBUTOR_ADDED_DEFAULT
fork_node_settings = fork.get_addon('osfstorage')
fork_node_settings.reload()

Expand Down
4 changes: 2 additions & 2 deletions admin/providers/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.shortcuts import redirect
from django.views.generic import TemplateView
from django.contrib import messages
from osf.models import RegistrationProvider, OSFUser, CollectionProvider, NotificationType
from osf.models import RegistrationProvider, OSFUser, CollectionProvider, NotificationTypeEnum
from website.settings import DOMAIN


Expand Down Expand Up @@ -63,7 +63,7 @@ def post(self, request, *args, **kwargs):

context['provider_url'] = f'{provider.domain or DOMAIN}{provider_type_word}/{(provider._id if not provider.domain else '').strip('/')}'
messages.success(request, f'The following {target_type} was successfully added: {target_user.fullname} ({target_user.username})')
notification_type = NotificationType.Type.PROVIDER_MODERATOR_ADDED
notification_type = NotificationTypeEnum.PROVIDER_MODERATOR_ADDED
notification_type.instance.emit(
user=target_user,
event_context=context,
Expand Down
5 changes: 2 additions & 3 deletions admin/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from osf.models.base import Guid
from osf.models.user import OSFUser
from osf.models.spam import SpamStatus
from osf.models.notification_type import NotificationType
from osf.models.notification_type import NotificationTypeEnum
from framework.auth import get_user
from framework.auth.core import generate_verification_key

Expand Down Expand Up @@ -184,12 +184,11 @@ def post(self, request, *args, **kwargs):
message=f'User account {user.pk} disabled',
action_flag=USER_REMOVED
)
NotificationType.Type.USER_REQUEST_DEACTIVATION_COMPLETE.instance.emit(
NotificationTypeEnum.USER_REQUEST_DEACTIVATION_COMPLETE.instance.emit(
user=user,
event_context={
'user_fullname': user.fullname,
'contact_email': OSF_SUPPORT_EMAIL,
'can_change_preferences': False,
}
)
else:
Expand Down
4 changes: 2 additions & 2 deletions admin_tests/preprints/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.contrib.messages.storage.fallback import FallbackStorage

from tests.base import AdminTestCase
from osf.models import Preprint, PreprintLog, PreprintRequest, NotificationType
from osf.models import Preprint, PreprintLog, PreprintRequest, NotificationTypeEnum
from framework.auth import Auth
from osf_tests.factories import (
AuthUserFactory,
Expand Down Expand Up @@ -719,7 +719,7 @@ def test_can_unwithdraw_preprint_without_moderation_workflow(self, withdrawal_re
machine_state=DefaultStates.INITIAL.value)
withdrawal_request.run_submit(admin)

with assert_notification(type=NotificationType.Type.PREPRINT_REQUEST_WITHDRAWAL_APPROVED):
with assert_notification(type=NotificationTypeEnum.PREPRINT_REQUEST_WITHDRAWAL_APPROVED):
withdrawal_request.run_accept(admin, withdrawal_request.comment)

assert preprint.machine_state == 'withdrawn'
Expand Down
10 changes: 5 additions & 5 deletions admin_tests/users/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from admin.users.forms import UserSearchForm, MergeUserForm
from osf.models.admin_log_entry import AdminLogEntry
from tests.utils import assert_notification, capture_notifications
from osf.models.notification_type import NotificationType
from osf.models.notification_type import NotificationTypeEnum

pytestmark = pytest.mark.django_db

Expand Down Expand Up @@ -105,7 +105,7 @@ def test_correct_view_permissions(self):
response = views.ResetPasswordView.as_view()(request, guid=guid)

assert len(notifications['emits']) == 1
assert notifications['emits'][0]['type'] == NotificationType.Type.USER_FORGOT_PASSWORD
assert notifications['emits'][0]['type'] == NotificationTypeEnum.USER_FORGOT_PASSWORD
self.assertEqual(response.status_code, 302)


Expand Down Expand Up @@ -168,15 +168,15 @@ def setUp(self):
def test_disable_user(self):
settings.ENABLE_EMAIL_SUBSCRIPTIONS = False
count = AdminLogEntry.objects.count()
with assert_notification(type=NotificationType.Type.USER_REQUEST_DEACTIVATION_COMPLETE, user=self.user):
with assert_notification(type=NotificationTypeEnum.USER_REQUEST_DEACTIVATION_COMPLETE, user=self.user):
self.view().post(self.request)
self.user.reload()
assert self.user.is_disabled
assert AdminLogEntry.objects.count() == count + 1

def test_reactivate_user(self):
settings.ENABLE_EMAIL_SUBSCRIPTIONS = False
with assert_notification(type=NotificationType.Type.USER_REQUEST_DEACTIVATION_COMPLETE, user=self.user):
with assert_notification(type=NotificationTypeEnum.USER_REQUEST_DEACTIVATION_COMPLETE, user=self.user):
self.view().post(self.request)
count = AdminLogEntry.objects.count()
self.view().post(self.request)
Expand Down Expand Up @@ -206,7 +206,7 @@ def test_correct_view_permissions(self):
change_permission = Permission.objects.get(codename='change_osfuser')
user.user_permissions.add(change_permission)
user.save()
with assert_notification(type=NotificationType.Type.USER_REQUEST_DEACTIVATION_COMPLETE, user=user):
with assert_notification(type=NotificationTypeEnum.USER_REQUEST_DEACTIVATION_COMPLETE, user=user):
request = RequestFactory().post(reverse('users:disable', kwargs={'guid': guid}))
request.user = user

Expand Down
4 changes: 2 additions & 2 deletions api/crossref/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from rest_framework.views import APIView

from api.crossref.permissions import RequestComesFromMailgun
from osf.models import Preprint, NotificationType
from osf.models import Preprint, NotificationTypeEnum
from website import settings
from website.preprints.tasks import mint_doi_on_crossref_fail

Expand Down Expand Up @@ -78,7 +78,7 @@ def post(self, request):
if unexpected_errors:
batch_id = crossref_email_content.find('batch_id').text
email_error_text = request.POST['body-plain']
NotificationType.Type.DESK_CROSSREF_ERROR.instance.emit(
NotificationTypeEnum.DESK_CROSSREF_ERROR.instance.emit(
destination_address=settings.OSF_SUPPORT_EMAIL,
event_context={
'batch_id': batch_id,
Expand Down
13 changes: 4 additions & 9 deletions api/institutions/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from osf import features
from osf.exceptions import InstitutionAffiliationStateError
from osf.models import Institution, NotificationType
from osf.models import Institution, NotificationTypeEnum
from osf.models.institution import SsoFilterCriteriaAction

from website.settings import OSF_SUPPORT_EMAIL, DOMAIN
Expand Down Expand Up @@ -348,11 +348,10 @@ def authenticate(self, request):
user.save()

# Send confirmation email for all three: created, confirmed and claimed
NotificationType.Type.USER_WELCOME_OSF4I.instance.emit(
NotificationTypeEnum.USER_WELCOME_OSF4I.instance.emit(
user=user,
event_context={
'domain': DOMAIN,
'osf_support_email': OSF_SUPPORT_EMAIL,
'user_fullname': user.fullname,
'storage_flag_is_active': flag_is_active(request, features.STORAGE_I18N),
},
Expand All @@ -363,14 +362,12 @@ def authenticate(self, request):
if email_to_add:
assert not is_created and email_to_add == sso_email
user.emails.create(address=email_to_add)
NotificationType.Type.USER_ADD_SSO_EMAIL_OSF4I.instance.emit(
NotificationTypeEnum.USER_ADD_SSO_EMAIL_OSF4I.instance.emit(
user=user,
event_context={
'user_fullname': user.fullname,
'email_to_add': email_to_add,
'domain': DOMAIN,
'osf_support_email': OSF_SUPPORT_EMAIL,
'storage_flag_is_active': flag_is_active(request, features.STORAGE_I18N),
},
save=False,
)
Expand All @@ -383,17 +380,15 @@ def authenticate(self, request):
duplicate_user.remove_sso_identity_from_affiliation(institution)
if secondary_institution:
duplicate_user.remove_sso_identity_from_affiliation(secondary_institution)
NotificationType.Type.USER_DUPLICATE_ACCOUNTS_OSF4I.instance.emit(
NotificationTypeEnum.USER_DUPLICATE_ACCOUNTS_OSF4I.instance.emit(
user=user,
subscribed_object=user,
event_context={
'user_fullname': user.fullname,
'user_username': user.username,
'user__id': user._id,
'duplicate_user_fullname': duplicate_user.fullname,
'duplicate_user_username': duplicate_user.username,
'duplicate_user__id': duplicate_user._id,
'domain': DOMAIN,
'osf_support_email': OSF_SUPPORT_EMAIL,
},
)
Expand Down
10 changes: 3 additions & 7 deletions api/nodes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
CedarMetadataRecord,
Preprint,
Collection,
NotificationType,
NotificationTypeEnum,
)
from addons.osfstorage.models import Region
from osf.utils.permissions import ADMIN, WRITE_NODE
Expand Down Expand Up @@ -1069,26 +1069,22 @@ def perform_create(self, serializer):
try:
fork = serializer.save(node=node)
except Exception as exc:
NotificationType.Type.NODE_FORK_FAILED.instance.emit(
NotificationTypeEnum.NODE_FORK_FAILED.instance.emit(
user=user,
subscribed_object=node,
event_context={
'domain': settings.DOMAIN,
'node_title': node.title,
'can_change_preferences': False,
},
)
raise exc

NotificationType.Type.NODE_FORK_COMPLETED.instance.emit(
NotificationTypeEnum.NODE_FORK_COMPLETED.instance.emit(
user=user,
subscribed_object=node,
event_context={
'domain': settings.DOMAIN,
'node_title': node.title,
'fork_title': fork.title,
'fork__id': fork._id,
'can_change_preferences': False,
},
)

Expand Down
4 changes: 2 additions & 2 deletions api/preprints/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
PreprintProvider,
Node,
NodeLicense,
NotificationType,
NotificationTypeEnum,
)
from osf.utils import permissions as osf_permissions
from osf.utils.workflows import DefaultStates
Expand Down Expand Up @@ -480,7 +480,7 @@ def update(self, preprint, validated_data):
preprint,
contributor=author,
auth=auth,
notification_type=NotificationType.Type.PREPRINT_CONTRIBUTOR_ADDED_DEFAULT,
notification_type=NotificationTypeEnum.PREPRINT_CONTRIBUTOR_ADDED_DEFAULT,
)

return preprint
Expand Down
6 changes: 3 additions & 3 deletions api/providers/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from api.preprints.serializers import PreprintProviderRelationshipField
from api.providers.workflows import Workflows
from api.base.metrics import MetricsSerializerMixin
from osf.models import CitationStyle, NotificationType, RegistrationProvider, CollectionProvider
from osf.models import CitationStyle, NotificationTypeEnum, RegistrationProvider, CollectionProvider
from osf.models.user import Email, OSFUser
from osf.models.validators import validate_email
from osf.utils.permissions import REVIEW_GROUPS, ADMIN
Expand Down Expand Up @@ -385,9 +385,9 @@ def create(self, validated_data):
provider.add_to_group(user, perm_group)
setattr(user, 'permission_group', perm_group) # Allows reserialization
if 'claim_url' in context:
notification_type = NotificationType.Type.PROVIDER_CONFIRM_EMAIL_MODERATION
notification_type = NotificationTypeEnum.PROVIDER_CONFIRM_EMAIL_MODERATION
else:
notification_type = NotificationType.Type.PROVIDER_MODERATOR_ADDED
notification_type = NotificationTypeEnum.PROVIDER_MODERATOR_ADDED
notification_type.instance.emit(
user=user,
event_context=context,
Expand Down
Loading