Skip to content

Commit d66b3f2

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into feature/pbs-25-25
2 parents f7737e8 + 530b7f4 commit d66b3f2

File tree

408 files changed

+16050
-12617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

408 files changed

+16050
-12617
lines changed

.github/workflows/test-build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,31 @@ jobs:
201201
- name: Upload report
202202
if: (github.event_name != 'pull_request') && (success() || failure()) # run this step even if previous step failed
203203
uses: ./.github/actions/gen-report
204+
205+
scripts:
206+
runs-on: ubuntu-22.04
207+
permissions:
208+
checks: write
209+
needs: build-cache
210+
services:
211+
postgres:
212+
image: postgres
213+
214+
env:
215+
POSTGRES_PASSWORD: ${{ env.OSF_DB_PASSWORD }}
216+
options: >-
217+
--health-cmd pg_isready
218+
--health-interval 10s
219+
--health-timeout 5s
220+
--health-retries 5
221+
ports:
222+
# Maps tcp port 5432 on service container to the host
223+
- 5432:5432
224+
steps:
225+
- uses: actions/checkout@v2
226+
- uses: ./.github/actions/start-build
227+
- name: Run tests
228+
run: poetry run python3 -m invoke test-ci-scripts -n 1 --junit
229+
- name: Upload report
230+
if: (github.event_name != 'pull_request') && (success() || failure()) # run this step even if previous step failed
231+
uses: ./.github/actions/gen-report

CHANGELOG

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,41 @@
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+
12+
26.1.3 (2026-01-05)
13+
===================
14+
15+
- Increase NR migration timeout and batch size
16+
17+
26.1.2 (2026-01-05)
18+
===================
19+
20+
- Notifications Refactor Phase 2 - UAT Hotfix Part 2
21+
* Fix adding moderator email in admin
22+
* Fix preprint/registration withdrawal request email in digest
23+
* Fix subjects for schema response update emails
24+
* Update defauls for triggered emails
25+
26+
26.1.1 (2026-01-02)
27+
===================
28+
29+
- Notifications Refactor Phase 2 - UAT Hotfix Part 1
30+
* Fix reset password url
31+
* Fix logout query for new user confirmation url
32+
* Fix new user default notification subscription
33+
* Clean-up / Sync settings
34+
35+
26.1.0 (2026-01-01)
36+
===================
37+
38+
- Notifications Refactor Phase 2 Project Release
39+
540
25.18.2 (2025-12-19)
641
====================
742

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+
)

README-docker-compose.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,12 @@
270270
```bash
271271
docker compose run --rm web python3 -m scripts.parse_citation_styles
272272
```
273+
- Populate Notification Types
274+
- Needed for notifications.
275+
```bash
276+
docker compose run --rm web python3 manage.py populate_notification_types
277+
```
278+
- _NOTE: The waffle switch `POPULATE_NOTIFICATION_TYPES` needs to be turned on.
273279
- Start ember_osf_web
274280
- Needed for ember app:
275281
- `docker-compose up -d ember_osf_web`

addons/base/views.py

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
from framework.flask import redirect
3535
from framework.sentry import log_exception
3636
from framework.transactions.handlers import no_auto_transaction
37-
from website import mails
3837
from website import settings
3938
from addons.base import signals as file_signals
4039
from addons.base.utils import format_last_known_metadata, get_mfr_url
@@ -52,7 +51,7 @@
5251
DraftRegistration,
5352
Guid,
5453
FileVersionUserMetadata,
55-
FileVersion
54+
FileVersion, NotificationType
5655
)
5756
from osf.metrics import PreprintView, PreprintDownload
5857
from osf.utils import permissions
@@ -64,7 +63,7 @@
6463
from website.util import rubeus
6564

6665
# import so that associated listener is instantiated and gets emails
67-
from website.notifications.events.files import FileEvent # noqa
66+
from notifications.file_event_notifications import FileEvent # noqa
6867

6968
ERROR_MESSAGES = {'FILE_GONE': """
7069
<style>
@@ -226,8 +225,6 @@ def get_auth(auth, **kwargs):
226225
_check_resource_permissions(resource, auth, action)
227226

228227
provider_name = waterbutler_data['provider']
229-
waterbutler_settings = None
230-
waterbutler_credentials = None
231228
file_version = file_node = None
232229
if provider_name == 'osfstorage' or (not flag_is_active(request, features.ENABLE_GV)):
233230
file_version, file_node = _get_osfstorage_file_version_and_node(
@@ -576,20 +573,32 @@ def create_waterbutler_log(payload, **kwargs):
576573
params=payload
577574
)
578575

579-
if payload.get('email') is True or payload.get('errors'):
580-
mails.send_mail(
581-
user.username,
582-
mails.FILE_OPERATION_FAILED if payload.get('errors')
583-
else mails.FILE_OPERATION_SUCCESS,
584-
action=payload['action'],
585-
source_node=source_node,
586-
destination_node=destination_node,
587-
source_path=payload['source']['materialized'],
588-
source_addon=payload['source']['addon'],
589-
destination_addon=payload['destination']['addon'],
590-
osf_support_email=settings.OSF_SUPPORT_EMAIL
576+
if payload.get('email') or payload.get('errors'):
577+
if payload.get('email'):
578+
notification_type = NotificationType.Type.USER_FILE_OPERATION_SUCCESS.instance
579+
if payload.get('errors'):
580+
notification_type = NotificationType.Type.USER_FILE_OPERATION_FAILED.instance
581+
notification_type.emit(
582+
user=user,
583+
subscribed_object=node,
584+
event_context={
585+
'user_fullname': user.fullname,
586+
'action': payload['action'],
587+
'source_node': source_node._id,
588+
'source_node_title': source_node.title,
589+
'destination_node': destination_node._id,
590+
'destination_node_title': destination_node.title,
591+
'destination_node_parent_node_title': destination_node.parent_node.title if destination_node.parent_node else None,
592+
'source_path': payload['source']['materialized'],
593+
'source_addon': payload['source']['addon'],
594+
'destination_addon': payload['destination']['addon'],
595+
'osf_support_email': settings.OSF_SUPPORT_EMAIL,
596+
'logo': settings.OSF_LOGO,
597+
'OSF_LOGO_LIST': settings.OSF_LOGO_LIST,
598+
'OSF_LOGO': settings.OSF_LOGO,
599+
'domain': settings.DOMAIN,
600+
}
591601
)
592-
593602
if payload.get('errors'):
594603
# Action failed but our function succeeded
595604
# Bail out to avoid file_signals
@@ -603,10 +612,8 @@ def create_waterbutler_log(payload, **kwargs):
603612
target_node = AbstractNode.load(metadata.get('nid'))
604613
if target_node and payload['action'] != 'download_file':
605614
update_storage_usage_with_size(payload)
606-
607615
with transaction.atomic():
608616
file_signals.file_updated.send(target=node, user=user, event_type=action, payload=payload)
609-
610617
return {'status': 'success'}
611618

612619

addons/boa/tasks.py

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
from addons.boa.boa_error_code import BoaErrorCode
1515
from framework import sentry
1616
from framework.celery_tasks import app as celery_app
17-
from osf.models import OSFUser
17+
from osf.models import OSFUser, NotificationType
1818
from osf.utils.fields import ensure_str, ensure_bytes
1919
from website import settings as osf_settings
20-
from website.mails import send_mail, ADDONS_BOA_JOB_COMPLETE, ADDONS_BOA_JOB_FAILURE
2120

2221
logger = logging.getLogger(__name__)
2322

@@ -184,18 +183,19 @@ async def submit_to_boa_async(host, username, password, user_guid, project_guid,
184183

185184
logger.info('Successfully uploaded query output to OSF.')
186185
logger.debug('Task ends <<<<<<<<')
187-
await sync_to_async(send_mail)(
188-
to_addr=user.username,
189-
mail=ADDONS_BOA_JOB_COMPLETE,
190-
fullname=user.fullname,
191-
query_file_name=query_file_name,
192-
query_file_full_path=file_full_path,
193-
output_file_name=output_file_name,
194-
job_id=boa_job.id,
195-
project_url=project_url,
196-
boa_job_list_url=boa_settings.BOA_JOB_LIST_URL,
197-
boa_support_email=boa_settings.BOA_SUPPORT_EMAIL,
198-
osf_support_email=osf_settings.OSF_SUPPORT_EMAIL,
186+
NotificationType.Type.ADDONS_BOA_JOB_COMPLETE.instance.emit(
187+
user=user,
188+
event_context={
189+
'user_fullname': user.fullname,
190+
'query_file_name': query_file_name,
191+
'query_file_full_path': file_full_path,
192+
'output_file_name': output_file_name,
193+
'job_id': boa_job.id,
194+
'project_url': project_url,
195+
'boa_job_list_url': boa_settings.BOA_JOB_LIST_URL,
196+
'boa_support_email': boa_settings.BOA_SUPPORT_EMAIL,
197+
'osf_support_email': osf_settings.OSF_SUPPORT_EMAIL,
198+
}
199199
)
200200
return BoaErrorCode.NO_ERROR
201201

@@ -209,22 +209,24 @@ def handle_boa_error(message, code, username, fullname, project_url, query_file_
209209
sentry.log_message(message, skip_session=True)
210210
except Exception:
211211
pass
212-
send_mail(
213-
to_addr=username,
214-
mail=ADDONS_BOA_JOB_FAILURE,
215-
fullname=fullname,
216-
code=code,
217-
message=message,
218-
query_file_name=query_file_name,
219-
file_size=file_size,
220-
max_file_size=boa_settings.MAX_SUBMISSION_SIZE,
221-
query_file_full_path=query_file_full_path,
222-
output_file_name=output_file_name,
223-
job_id=job_id,
224-
max_job_wait_hours=boa_settings.MAX_JOB_WAITING_TIME / 3600,
225-
project_url=project_url,
226-
boa_job_list_url=boa_settings.BOA_JOB_LIST_URL,
227-
boa_support_email=boa_settings.BOA_SUPPORT_EMAIL,
228-
osf_support_email=osf_settings.OSF_SUPPORT_EMAIL,
212+
NotificationType.Type.ADDONS_BOA_JOB_FAILURE.instance.emit(
213+
destination_address=username,
214+
event_context={
215+
'user_fullname': fullname,
216+
'code': code,
217+
'query_file_name': query_file_name,
218+
'file_size': file_size,
219+
'message': message,
220+
'max_file_size': boa_settings.MAX_SUBMISSION_SIZE,
221+
'query_file_full_path': query_file_full_path,
222+
'output_file_name': output_file_name,
223+
'job_id': job_id,
224+
'max_job_wait_hours': boa_settings.MAX_JOB_WAITING_TIME / 3600,
225+
'project_url': project_url,
226+
'boa_job_list_url': boa_settings.BOA_JOB_LIST_URL,
227+
'boa_support_email': boa_settings.BOA_SUPPORT_EMAIL,
228+
'osf_support_email': osf_settings.OSF_SUPPORT_EMAIL,
229+
230+
}
229231
)
230232
return code

0 commit comments

Comments
 (0)