Skip to content

Commit 530b7f4

Browse files
committed
Merge tag '26.1.4' into develop
NRP2 post-release fixes
2 parents f10b969 + 6e204bb commit 530b7f4

File tree

6 files changed

+167
-26
lines changed

6 files changed

+167
-26
lines changed

CHANGELOG

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
We follow the CalVer (https://calver.org/) versioning scheme: YY.MINOR.MICRO.
44

5+
26.1.4 (2026-01-06)
6+
===================
7+
8+
- Follow-up fix for preprint/registration withdrawal request
9+
- Added a script/task to populate default notification subscriptions that were missing before and after NR
10+
- Reworked PR template
11+
512
26.1.3 (2026-01-05)
613
===================
714

PULL_REQUEST_TEMPLATE.md

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,55 @@
1-
<!-- Before submit your Pull Request, make sure you picked
2-
the right branch:
1+
[//]: # (
2+
* Before submitting your Pull Request, make sure you've picked the right branch and your code is up-to-date with it.
3+
* For critical hotfixes, select "master" as the target branch.
4+
* For bugfixes, improvements and new features, select "develop" as the target branch.
5+
* If your PR is part of a project/team, select project/team's dedicated feature branch as the target.
6+
* If you have a JIRA ticket, prefix the ticket number [ENG-*****] to the PR title.
7+
)
38

4-
- For hotfixes, select "master" as the target branch
5-
- For new features, select "develop" as the target branch
6-
- For release feature fixes, select the relevant release branch (release/X.Y.Z) as the target branch -->
9+
## Ticket
10+
11+
[//]: # (Link to a JIRA ticket if available.)
12+
13+
* [ENG-*****]()
714

815
## Purpose
916

10-
<!-- Describe the purpose of your changes -->
17+
[//]: # (Briefly describe the purpose of this PR.)
1118

1219
## Changes
1320

14-
<!-- Briefly describe or list your changes -->
21+
[//]: # (Briefly describe or list your changes.)
1522

16-
## QA Notes
23+
## Side Effects
1724

25+
[//]: # (Any possible side effects?)
1826

19-
<!-- Please make verification statements inspired by your code and what your code touches.
20-
- Verify
21-
- Verify
22-
What are the areas of risk?
23-
Any concerns/considerations/questions that development raised?
24-
-->
27+
## QE Notes
2528

26-
## Documentation
29+
[//]: # (
30+
* Any QA testing notes for QE?
31+
* Make verification statements inspired by your code and what your code touches.
32+
* What are the areas of risk?
33+
* Any concerns/considerations/questions that development raised?
34+
* If you have a JIRA ticket, make sure the ticket also contains the QE notes.
35+
)
2736

28-
<!-- Does any internal or external documentation need to be updated?
29-
- If the API was versioned, update the developer.osf.io changelog.
30-
- If changes were made to the API, link the developer.osf.io PR here.
31-
-->
37+
## CE Notes
3238

33-
## Side Effects
34-
35-
<!-- Any possible side effects? -->
39+
[//]: # (
40+
* Any server configuration and deployment notes for CE?
41+
* Is model migration required? Is data migration/backfill/population required?
42+
* If so, is it reversible? Is there a roll-back plan?
43+
* Does server settings needs to be updated?
44+
* If so, have you checked with CE on existing settings for affected servers?
45+
* Are there any deployment dependencies to other services?
46+
* If you have a JIRA ticket, make sure the ticket also contains the CE notes.
47+
)
3648

37-
## Ticket
49+
## Documentation
3850

39-
<!-- Link to Jira ticket, if applicable e.g. https://openscience.atlassian.net/browse/OSF-1234 -->
51+
[//]: # (
52+
* Does any internal or external documentation need to be updated?
53+
* If the API was versioned, update the developer.osf.io changelog.
54+
* If changes were made to the API, link the developer.osf.io PR here.
55+
)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "OSF",
3-
"version": "26.1.3",
3+
"version": "26.1.4",
44
"description": "Facilitating Open Science",
55
"repository": "https://github.com/CenterForOpenScience/osf.io",
66
"author": "Center for Open Science",
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import django
2+
django.setup()
3+
4+
from website.app import init_app
5+
init_app(routes=False)
6+
7+
from framework.celery_tasks import app as celery_app
8+
from django.contrib.contenttypes.models import ContentType
9+
from django.db.models import Count, F, OuterRef, Subquery, IntegerField, CharField
10+
from django.db.models.functions import Cast
11+
from osf.models import OSFUser, Node, NotificationSubscription, NotificationType
12+
13+
14+
@celery_app.task(name='scripts.populate_notification_subscriptions')
15+
def populate_notification_subscriptions():
16+
created = 0
17+
user_file_nt = NotificationType.Type.USER_FILE_UPDATED.instance
18+
review_nt = NotificationType.Type.REVIEWS_SUBMISSION_STATUS.instance
19+
node_file_nt = NotificationType.Type.NODE_FILE_UPDATED.instance
20+
21+
user_ct = ContentType.objects.get_for_model(OSFUser)
22+
node_ct = ContentType.objects.get_for_model(Node)
23+
24+
reviews_qs = OSFUser.objects.exclude(subscriptions__notification_type__name=NotificationType.Type.REVIEWS_SUBMISSION_STATUS).distinct('id')
25+
files_qs = OSFUser.objects.exclude(subscriptions__notification_type__name=NotificationType.Type.USER_FILE_UPDATED).distinct('id')
26+
27+
node_notifications_sq = (
28+
NotificationSubscription.objects.filter(
29+
content_type=node_ct,
30+
notification_type=node_file_nt,
31+
object_id=Cast(OuterRef('pk'), CharField()),
32+
).values(
33+
'object_id'
34+
).annotate(
35+
cnt=Count('id')
36+
).values('cnt')[:1]
37+
)
38+
39+
nodes_qs = (
40+
Node.objects
41+
.annotate(
42+
contributors_count=Count('_contributors', distinct=True),
43+
notifications_count=Subquery(
44+
node_notifications_sq,
45+
output_field=IntegerField(),
46+
),
47+
).exclude(contributors_count=F('notifications_count'))
48+
)
49+
50+
print(f"Creating REVIEWS_SUBMISSION_STATUS subscriptions for {reviews_qs.count()} users.")
51+
for id, user in enumerate(reviews_qs, 1):
52+
print(f"Processing user {id} / {reviews_qs.count()}")
53+
try:
54+
_, is_created = NotificationSubscription.objects.get_or_create(
55+
notification_type=review_nt,
56+
user=user,
57+
content_type=user_ct,
58+
object_id=user.id,
59+
defaults={
60+
'message_frequency': 'none',
61+
},
62+
)
63+
if is_created:
64+
created += 1
65+
except Exception as exeption:
66+
print(exeption)
67+
continue
68+
69+
print(f"Creating USER_FILE_UPDATED subscriptions for {files_qs.count()} users.")
70+
for id, user in enumerate(files_qs, 1):
71+
print(f"Processing user {id} / {files_qs.count()}")
72+
try:
73+
_, is_created = NotificationSubscription.objects.get_or_create(
74+
notification_type=user_file_nt,
75+
user=user,
76+
content_type=user_ct,
77+
object_id=user.id,
78+
defaults={
79+
'message_frequency': 'none',
80+
},
81+
)
82+
if is_created:
83+
created += 1
84+
except Exception as exeption:
85+
print(exeption)
86+
continue
87+
88+
print(f"Creating NODE_FILE_UPDATED subscriptions for {nodes_qs.count()} nodes.")
89+
for id, node in enumerate(nodes_qs, 1):
90+
print(f"Processing node {id} / {nodes_qs.count()}")
91+
for contributor in node.contributors.all():
92+
try:
93+
_, is_created = NotificationSubscription.objects.get_or_create(
94+
notification_type=node_file_nt,
95+
user=contributor,
96+
content_type=node_ct,
97+
object_id=node.id,
98+
defaults={
99+
'message_frequency': 'none',
100+
},
101+
)
102+
if is_created:
103+
created += 1
104+
except Exception as exeption:
105+
print(exeption)
106+
continue
107+
108+
print(f"Created {created} subscriptions")
109+
110+
if __name__ == '__main__':
111+
populate_notification_subscriptions.delay()

website/reviews/listeners.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ def reviews_notification(self, creator, template, context, action):
2525

2626
@reviews_signals.reviews_withdraw_requests_notification_moderators.connect
2727
def reviews_withdraw_requests_notification_moderators(self, timestamp, context, user, resource):
28-
context['referrer_fullname'] = user.fullname
28+
from website.profile.utils import get_profile_image_url
2929
context['requester_fullname'] = user.fullname
30+
context['profile_image_url'] = get_profile_image_url(resource.creator)
3031
provider = resource.provider
3132
from osf.models import NotificationType
3233

@@ -38,6 +39,7 @@ def reviews_withdraw_requests_notification_moderators(self, timestamp, context,
3839
for recipient in provider.get_group(group_name).user_set.all():
3940
context['user_fullname'] = recipient.fullname
4041
context['recipient_fullname'] = recipient.fullname
42+
context['localized_timestamp'] = str(timestamp)
4143

4244
NotificationType.Type.PROVIDER_NEW_PENDING_WITHDRAW_REQUESTS.instance.emit(
4345
user=recipient,
@@ -48,7 +50,9 @@ def reviews_withdraw_requests_notification_moderators(self, timestamp, context,
4850

4951
@reviews_signals.reviews_email_withdrawal_requests.connect
5052
def reviews_withdrawal_requests_notification(self, timestamp, context):
53+
from website.profile.utils import get_profile_image_url
5154
preprint = context.pop('reviewable')
55+
context['profile_image_url'] = get_profile_image_url(preprint.creator)
5256
context['reviewable_absolute_url'] = preprint.absolute_url
5357
context['reviewable_title'] = preprint.title
5458
context['reviewable__id'] = preprint._id
@@ -63,6 +67,7 @@ def reviews_withdrawal_requests_notification(self, timestamp, context):
6367
for recipient in preprint.provider.get_group(group_name).user_set.all():
6468
context['user_fullname'] = recipient.fullname
6569
context['recipient_fullname'] = recipient.fullname
70+
context['localized_timestamp'] = str(timestamp)
6671

6772
NotificationType.Type.PROVIDER_NEW_PENDING_WITHDRAW_REQUESTS.instance.emit(
6873
user=recipient,

website/settings/defaults.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ class CeleryConfig:
450450
'osf.management.commands.monthly_reporters_go',
451451
'osf.management.commands.ingest_cedar_metadata_templates',
452452
'osf.metrics.reporters',
453+
'scripts.populate_notification_subscriptions',
453454
}
454455

455456
med_pri_modules = {
@@ -578,6 +579,7 @@ class CeleryConfig:
578579
'osf.management.commands.monthly_reporters_go',
579580
'osf.external.spam.tasks',
580581
'api.share.utils',
582+
'scripts.populate_notification_subscriptions',
581583
)
582584

583585
# Modules that need metrics and release requirements

0 commit comments

Comments
 (0)