Skip to content

[ENG-10538] Post-NR Project PR#11623

Merged
cslzchen merged 126 commits intodevelopfrom
feature/notifications-refactor-post-release
Mar 13, 2026
Merged

[ENG-10538] Post-NR Project PR#11623
cslzchen merged 126 commits intodevelopfrom
feature/notifications-refactor-post-release

Conversation

@Ostap-Zherebetskyi
Copy link
Collaborator

@Ostap-Zherebetskyi Ostap-Zherebetskyi commented Mar 5, 2026

Ticket

Purpose

Changes

Side Effects

QE Notes

CE Notes

Documentation

cslzchen and others added 30 commits January 19, 2026 11:29
* Use USER_FILE_UPDATED for group global_file_updated
* Use REVIEWS_SUBMISSION_STATUS for group global_reviews
[ENG-10083] Add type and is_digest "relation" and update subscription
cslzchen and others added 14 commits February 27, 2026 10:45
…_sync_task

[ENG-10076] Add Celery task to delete removed beat tasks from PeriodicTask entries
…pe-defenitions

[ENG-9923] Sync naming of notifications
…migration

[ENG-10496] Fix migration due to postgres limitation
[ENG-10535] Update the no_login mail send conditions
[ENG-10535] Update the no_login mail send conditions
…refactor-with-develop

[ENG-10530] Merge notifications refactor with develop after ROR release
Copy link
Collaborator Author

@Ostap-Zherebetskyi Ostap-Zherebetskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ⭐

@Ostap-Zherebetskyi Ostap-Zherebetskyi marked this pull request as ready for review March 9, 2026 10:58
cslzchen and others added 10 commits March 10, 2026 09:35
…ifications

[ENG-10547] Collections: Project link pointing to api request instead of FE overview for all add/remove to collection notifications
…ifications

[ENG-10547] Collections: fix logo url
…e_notification_types_to_admin

[ENG-10570] Add management command to sync notification templates in admin
[ENG-10611] Add delete_withdrawn_or_failed_registration_files import
…st_logo

[ENG-10547] Fix collections digest logo
@cslzchen cslzchen changed the title [ENG-10538] Post-NR with Migration [ENG-10538] Post-NR Project PR Mar 13, 2026
Copy link
Collaborator

@cslzchen cslzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐ LGTM, my comments are for code clean-up only. Let's take care of the code clean-up after release as a separate squash merge commit.



@celery_app.task(name='scripts.remove_after_use.populate_notification_subscriptions_node_file_updated')
def populate_notification_subscriptions_node_file_updated(batch_size: int = 1000):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed since we have the create-on-missing fix.

print('----Creation finished----')

@celery_app.task(name='scripts.remove_after_use.update_notification_subscriptions_node_file_updated')
def update_notification_subscriptions_node_file_updated():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed since our de-duplication v2 command already fix the _id_digest issue.

from osf.models import OSFUser, NotificationSubscription, NotificationTypeEnum

@celery_app.task(name='scripts.remove_after_use.populate_notification_subscriptions_user_global_file_updated')
def populate_notification_subscriptions_user_global_file_updated(per_last_years: int | None= None, batch_size: int = 1000):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, no longer needed since we have the create-on-missing fix.

print('----Creation finished----')

@celery_app.task(name='scripts.remove_after_use.update_notification_subscriptions_user_global_file_updated')
def update_notification_subscriptions_user_global_file_updated():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, no longer needed since our de-duplication v2 command already fix the _id_digest issue.

print('----Creation finished----')

@celery_app.task(name='scripts.remove_after_use.update_notification_subscriptions_user_global_reviews')
def update_notification_subscriptions_user_global_reviews():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, no longer needed since our de-duplication v2 command already fix the _id_digest issue.

Comment on lines -1715 to +1720
Rule(
'/subscriptions/',
'get',
notification_views.get_subscriptions,
json_renderer,
),
# Legacy v1 API for notifications, which is no longer used by Angular/Post-NR
# Rule(
# '/subscriptions/',
# 'get',
# notification_views.get_subscriptions,
# json_renderer,
# ),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be safe to remove now

Comment on lines -1722 to +1731
Rule(
[
'/project/<pid>/subscriptions/',
'/project/<pid>/node/<nid>/subscriptions/'
],
'get',
notification_views.get_node_subscriptions,
json_renderer,
),
# Legacy v1 API for notifications, which is no longer used by Angular/Post-NR
# Rule(
# [
# '/project/<pid>/subscriptions/',
# '/project/<pid>/node/<nid>/subscriptions/'
# ],
# 'get',
# notification_views.get_node_subscriptions,
# json_renderer,
# ),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, safe to remove

Comment on lines -1742 to +1749
Rule(
'/subscriptions/',
'post',
notification_views.configure_subscription,
json_renderer,
),
# Legacy v1 API for notifications, which is no longer used by Angular/Post-NR
# Rule(
# '/subscriptions/',
# 'post',
# notification_views.configure_subscription,
# json_renderer,
# ),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, safe to remove

from osf.models import NotificationSubscription, NotificationType, NotificationTypeEnum


class Command(BaseCommand):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not this v2 one. We can remove the old de-duplication command.

@cslzchen cslzchen merged commit 31048c7 into develop Mar 13, 2026
16 checks passed
adlius added a commit that referenced this pull request Mar 19, 2026
* [ENG-10083] Add type<-->is_digest "relation" and update subscription (#11575)

* Add is_digest_type property to NotificationType and log message in emit method
* Fix is_digest handling in NotificationType.emit method
* Log message update in NotificationType.emit method for is_digest handling
* fix unit tests

---------

Co-authored-by: Ostap Zherebetskyi <ozherebetskyi@exoft.net>

* Add notification subscriptions de-duplication v2 command (#11576)

Co-authored-by: Ostap Zherebetskyi <ozherebetskyi@exoft.net>

* [ENG-10190][ENG-10214] Permanently update a couple of templates to match admin/admin changes

Update archive_size_exceeded_user and provider_reviews_resubmission_confirmation templates

* Update changelog and bump version

* Exclude spam and deleted Registration from queryset (#11572)

* [ENG-10135] - Fix/eng 10135 (#11587)

* Exclude spam and deleted Registration from queryset

* Update RegistrationActionList to check deleted flag

* Fix tests

* Fix test

* Feature/fair signposting (#11599)

* linkset initial implementation

* linkset initial implementation (updating data extraction and adding serialization)

* and \n in EOF instead of %

* update code

* get file mediatype from metadata

* add unittests for linkset approach (TODO: ?)

* update code

* update code and unit tests and

* update file related code and unit tests

* refactor code after CR | implement 'describes' |  check file type differs from parent project / registry / preprint

* update files to compare on unittests run

* implement datacite - scheme type mapping for linkset draft version (need tests updates and maybe some type yield logic )

* Update osf/metadata/osf_gathering.py

Co-authored-by: abram axel booth <aaxelb@users.noreply.github.com>

* Update osf/metadata/serializers/linkset.py

Co-authored-by: abram axel booth <aaxelb@users.noreply.github.com>

* implement datacite - schema mapping

* update tests expected results

* resolve CR

* refactor code | resolve CR

* remove redundant describes from file response (#11590)

* [ENG-10256] 2.1.9 BE: Fix permission issue where users without permission to an object can access the metadata (#11588)

* Fix permission issue where users without permission to an object can access the metadata (add decorator is_contributor_or_public_resource)

* refactor code

* resolve CR | refactor code

* resolve CR | add unittests

* add  *args, **kwargs for decorated view

* [ENG-10167] 2.1.6 BE: add link header to guid metadata endpoints (#11594)

* add link header to guid metadata endpoints for registry and project

* update code

* avoid Component Registration/Project JSON Contains type: null (#11597)

* [ENG-10168] 2.1.7 BE: add link header to cedar metadata records endpoints (#11596)

* add link header to guid metadata endpoints for registry and project

* update code

* add link header to cedar metadata records endpoints

* change ResearchProject for CreativeWork for projects (#11603)

* [ENG-10169] 2.1.8 BE: add link header to file download URL (#11600)

* avoid Component Registration/Project JSON Contains type: null

* add link header to file download URL

* update unittests

* resolve CR

---------

Co-authored-by: mkovalua <mkoval@exoft.net>
Co-authored-by: abram axel booth <aaxelb@users.noreply.github.com>

* Bump versio no. Add CHANGELOG

* [ENG-10054] feature/ror-migration (#11610)

* feat(osf): script to migrate Crossref Funder IDs to ROR IDs

* feat(osf): Fix fot the script to migrate Crossref Funder IDs to ROR IDs

* feat(osf): Update OSF metadata model code and tests for ROR funder identifier support

* feat(osf): Add DataCite client tests for ROR funder identifier support

* feat(osf): update migration script to remove unmapped crossref funders

* add another stat to the migration script

---------

Co-authored-by: Andriy Sheredko <sheredko.andriy@gmail.com>

* bump version & update changelog

* add command to migrate ror funder names

* bump version & update changelog

* [ENG-10538] Post-NR Project PR (#11623)

* Create global_file_updated and global_reviews subscriptions if missing
* Use USER_FILE_UPDATED for group global_file_updated
* Use REVIEWS_SUBMISSION_STATUS for group global_reviews
* Add missing `is_digest=True` for new OSF user subscriptions
* Extend otf subscription creation to apply to _node_file_updated group
* Fix typo for `_is_digest`
* add is_digest_type property
* Add is_digest_type property to NotificationType and log message in emit method
* Fix is_digest handling in NotificationType.emit method
* Log message update in NotificationType.emit method for is_digest handling
* fix unit tests
* Move set-deafult-subscriptions out of non-effective try-except
* Add fake_sent field to Notification model and update notification creation logic
* add unique_together constraint
* Add 'PARTIAL_SUCCESS' status to EmailTask model and update email task handling logic
* NR migration [ENG-10040, ENG-10025, ENG-9854]
* Remove subscription if notifications.tasks.send_moderator_email_task fails with permission error
* Apply suggestion from @Ostap-Zherebetskyi
* remove datetime
* Add 'no_login_email_last_sent' field to OSFUser and update email task logic
* Enforce and improve permission check for subscriptions
* Fix typo in annotated_obj_qs for NODE_FILE_UPDATED
* Add unit tests for testing node_file_updated subscription detail
* Implement notifications cleanup task and related settings; add tests for functionality
* Fix legacy subscription ID for NODE_FILE_UPDATED: "guid_files_updated"
* Fix duplicate and mismatched type NODE_FILE(S)_UPDATED
* removed email.py
* Fix annotated qs for global reviews and update unit tests
* Update tests for node_file(s)_updated subscription detail
* Rename fixtures for notification subscription detail tests
* Annotate with legacy_id for serializer to handle created subscriptions
* Add unit tests for creating missing subscriptions on the fly
* clear useless code
* Rename migration name for NR post-release
* Improve unit test: test_emit_frequency_none
* Remove `seen` from `Notification` and re-make migrations
* `mark_sent()` now handles `fake_sent=True`, and only `save()` once
* Update default settings
* remove useless import
* Enhance SubscriptionList queryset with additional content types and refactor notification type handling
* fix unit test
* Refactor SubscriptionList queryset to use a single provider content type and update related notification handling; add script to update notification subscriptions' content types.
* fix CR comments
* Update comments
* split into 3 files
* remove populate_notification_subscriptions
* Renamed files, refactor of populate notification subscriptions user global file updated
* added try/except, added timers
* converted populate_notification_subscriptions_user_global_reviews.py
* fix batch time execution
* converted populate_notification_subscriptions_node_file_updated
* convert to separate update and create scripts
* updated, added parameters
* move to remove_after_use
* add time track to last batch, fix proper time track for batch in node_file_updated
* convert to use review_nt
* Fix unit tests due to new constraints
* Move missing subscription creation to a helper function in utils
* Subscription list view now creates missing attributes on-the-fly
  * Note: only works for when filter on "legacy id"; logs message to sentry for tracking purpose when filter on "event names".
* Fix broken `.exists()` due to complex annotated QS with `.distinct()`
* fix names of tasks
* Add notification subscriptions de-duplication v2 command
* fix naming
* Add deduplication command to notification migration
* Fix notification handling by updating legacy ID suffix from '_files_updated' to '_file_updated' across utils and views; adjust related test cases accordingly.
* fix unit tests
* Update the name of the NotificationType NODE_FILE_UPDATED to be consistent
* Rename notification type from node_files_updated to node_file_updated for consistency
* clean keys
* fix naming in templates, event_context
* remove leftover comments
* Refactor notification type references to use NotificationTypeEnum
  - Updated all instances of NotificationType.Type to NotificationTypeEnum in test files and application code.
  - Ensured consistency in notification type usage across various tests including auth, claims, events, and more.
  - This change improves clarity and maintainability by standardizing the notification type references.
* Fix notification type reference for FILE_UPDATED
* Refactor notification type references to use NotificationTypeEnum across views and scripts
* fix unit tests
* remove imports
* fix USER_CROSSREF_DOI_PENDING event_context
* sync naming
* added explanation
* Add Celery task to disable removed beat tasks from PeriodicTask entries
* Apply suggestion from @Ostap-Zherebetskyi
* Apply suggestion from @cslzchen
* Add migrations to remove duplicate notification subscriptions and refactor notification model
* removed comment
* Refactor no-login email filtering to ensure last sent date is before last login date
* Add test to exclude users logged in before no_login_email_last_sent
* Refactor no-login email user filtering to exclude those with pending EmailTasks and recent no-login emails
* Fix CollectionSubmission URLs to use absolute_url method for consistency
* Refactor logo handling in notification methods to improve consistency and readability
* Add management command to sync notification templates
* Apply suggestion from @cslzchen
* Add management command for deleting withdrawn or failed registration files to CeleryConfig
* fix: update logo handling in send_moderator_email_task for favicon support

---------

Co-authored-by: Longze Chen <cslzchen@gmail.com>
Co-authored-by: Ostap Zherebetskyi <ozherebetskyi@exoft.net>
Co-authored-by: Bohdan Odintsov <bodintsov@exoft.net>

* Updated cut-off time and added comments for NR settings

* Update changelog and bump version

* resolve merge conflicts

* respond to CR comments

* fix tests

* fix tests again

---------

Co-authored-by: Longze Chen <cslzchen@gmail.com>
Co-authored-by: Ostap Zherebetskyi <ozherebetskyi@exoft.net>
Co-authored-by: Vlad0n20 <137097005+Vlad0n20@users.noreply.github.com>
Co-authored-by: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com>
Co-authored-by: mkovalua <mkoval@exoft.net>
Co-authored-by: abram axel booth <aaxelb@users.noreply.github.com>
Co-authored-by: Fitz Elliott <fitz@cos.io>
Co-authored-by: Andriy Sheredko <sheredko.andriy@gmail.com>
Co-authored-by: Bohdan Odintsov <bodintsov@exoft.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants