Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
229 commits
Select commit Hold shift + click to select a range
e485f2a
test CI
Ostap-Zherebetskyi Apr 22, 2025
a968f71
remove osf groups
Ostap-Zherebetskyi May 1, 2025
509d958
remove osf groups
Ostap-Zherebetskyi May 1, 2025
ff7244b
remove osf groups
Ostap-Zherebetskyi May 1, 2025
0d78f9e
remove osf groups
Ostap-Zherebetskyi May 1, 2025
c217e04
remove osf groups
Ostap-Zherebetskyi May 1, 2025
878d2c7
Merge pull request #11122 from Ostap-Zherebetskyi/feature/osfgroup
Johnetordoff May 12, 2025
e1eb72a
Remove Meetings, Comments and OSF Groups Notifications
Ostap-Zherebetskyi May 7, 2025
b20470f
Clean up imports
Ostap-Zherebetskyi May 8, 2025
b011991
Clean up tests
Ostap-Zherebetskyi May 8, 2025
d9004bc
Clean up tests
Ostap-Zherebetskyi May 8, 2025
2d3d1c0
Merge pull request #11133 from Ostap-Zherebetskyi/feature/ENG-7908-re…
Johnetordoff May 12, 2025
91d048d
Update send_mail mocks
Ostap-Zherebetskyi May 19, 2025
57b0bd1
add new data model for notifications
Johnetordoff May 20, 2025
929b9fd
Merge branch 'feature/pbs-25-10' of https://github.com/CenterForOpenS…
Johnetordoff May 22, 2025
69231e9
add new notificationsubscription class to views
Johnetordoff May 27, 2025
a8b5727
update mails mock
Ostap-Zherebetskyi May 28, 2025
c324716
Merge branch 'feature/pbs-25-10' of https://github.com/CenterForOpenS…
Johnetordoff May 28, 2025
40b38f7
Merge branch 'feature/pbs-25-10' of https://github.com/CenterForOpenS…
Johnetordoff May 30, 2025
73cc32f
remove quickfiles
bodintsov Jun 2, 2025
d109be9
fixed tests
bodintsov Jun 2, 2025
41b3a72
flake8
bodintsov Jun 3, 2025
e8d1370
Merge branch 'feature/pbs-25-10' of https://github.com/CenterForOpenS…
Johnetordoff Jun 3, 2025
3fda17f
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jun 3, 2025
1a2f7c1
Merge branch 'feature/remove-remaining-quickiles-code' of https://git…
Johnetordoff Jun 3, 2025
013d422
Merge branch 'feature/remove_test_speed-up' of https://github.com/Ost…
Johnetordoff Jun 3, 2025
f7f8197
Merge pull request #11167 from Johnetordoff/feature/notification-refa…
Johnetordoff Jun 3, 2025
358091c
Merge branch 'feature/pbs-25-10' of https://github.com/CenterForOpenS…
Johnetordoff Jun 3, 2025
5165ab9
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jun 3, 2025
fbc7d3f
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jun 3, 2025
22c62df
ignore Django maintenance state outside block
Johnetordoff Jun 5, 2025
1c7e2d2
Add MailHog email testing functionality
Ostap-Zherebetskyi Jun 5, 2025
09cf6e8
fix new and noteworth nodes bug going to Sentry
Johnetordoff Jun 8, 2025
2ab3589
Merge branch 'feature/pbs-25-10' of https://github.com/CenterForOpenS…
Johnetordoff Jun 9, 2025
c449599
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jun 9, 2025
97b97ab
remove superfluildous `groups` from serializer
Johnetordoff Jun 9, 2025
a68e12c
Merge pull request #11177 from Johnetordoff/refactor-notifications
Johnetordoff Jun 9, 2025
e0a0765
add mailhog unit tests
Ostap-Zherebetskyi Jun 10, 2025
1b70ff2
update CI
Ostap-Zherebetskyi Jun 10, 2025
62f0fd9
fixed bug with contributors
bodintsov Jun 11, 2025
0907a7d
Merge pull request #11181 from bodintsov/fix/fix-contributors-not-sho…
Johnetordoff Jun 11, 2025
d83c2c3
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jun 13, 2025
2911fb3
handle django core validation error in drf view
antkryt Jun 16, 2025
1764be0
Merge branch 'develop' of https://github.com/CenterForOpenScience/osf…
Johnetordoff Jun 16, 2025
f550c61
fix absolute url issue
Johnetordoff Jun 16, 2025
458fbfd
fix up unit test issues
Johnetordoff Jun 16, 2025
e0c54dd
Merge branch 'feature/pbs-25-10' of https://github.com/CenterForOpenS…
Johnetordoff Jun 17, 2025
b11c15c
add unit tests
antkryt Jun 18, 2025
16c5409
Merge branch 'feature/pbs-25-10' of https://github.com/CenterForOpenS…
Johnetordoff Jun 25, 2025
5864187
Merge branch 'feature/pbs-25-10' of https://github.com/CenterForOpenS…
Johnetordoff Jun 30, 2025
bb145f4
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jun 30, 2025
a2c6022
Merge pull request #11107 from Ostap-Zherebetskyi/feature/old_templates
Johnetordoff Jun 30, 2025
d7f8c7a
add registration_word for registration provider
antkryt Jun 30, 2025
42b3829
[ENG-8290] Allow collection search POST with token scope (#11201)
antkryt Jun 30, 2025
ef9c076
[ENG-8247] Ability to delete draft preprints from database (#11191)
ihorsokhanexoft Jun 30, 2025
9aa22ee
[ENG-8193] Fix issues with Preprint submission via API (#11185)
antkryt Jun 30, 2025
3e609ac
[ENG-8192] Ability to force archive registrations when OSFS Folders h…
antkryt Jun 30, 2025
ee1aeb4
add additional information to user admin (#11184)
antkryt Jun 30, 2025
33e86b3
upgrade django to 4.2.17 (#11173)
ihorsokhanexoft Jun 30, 2025
cf621c3
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jun 30, 2025
6c23802
added retry to avoid race condition (#11179)
ihorsokhanexoft Jun 30, 2025
ffaef7a
[ENG-8096] Admins on projects are unable to reject user access reques…
antkryt Jun 30, 2025
2beb44e
fix content overflow for node page (#11182)
antkryt Jun 30, 2025
689aa78
don't add multiple group perms for preprint provider (#11159)
antkryt Jun 30, 2025
a02120f
fixed children/parent fields in admin templates (#11156)
ihorsokhanexoft Jun 30, 2025
2e03570
[ENG-7962] Fix User Setting Response Payload async mailchimp perferen…
Johnetordoff Jun 30, 2025
a035dbf
improved displaying of stashed urls and approval state in admin (#11193)
ihorsokhanexoft Jun 30, 2025
5af4c80
[ENG-5862] SPAM - Fix Wiki Spamming (#11171)
antkryt Jun 30, 2025
fdfbcc4
switch to new UI when user views draft registration file (#11144)
ihorsokhanexoft Jun 30, 2025
87d3276
mailhog ci update
Ostap-Zherebetskyi Jul 1, 2025
6062cef
[ENG-7929] Ability to move registrations to draft state (#11153)
ihorsokhanexoft Jul 1, 2025
4391db2
added a route to download node metadata (#11215)
ihorsokhanexoft Jul 1, 2025
2f102f7
Merge pull request #11170 from Ostap-Zherebetskyi/feature/update_mail…
Johnetordoff Jul 2, 2025
b62daac
Merge branch 'develop' of https://github.com/CenterForOpenScience/osf…
Johnetordoff Jul 2, 2025
300524c
fix backward compat issues and remove old tests
Johnetordoff Jul 2, 2025
3a682b3
Merge branch 'develop' of https://github.com/CenterForOpenScience/osf…
Johnetordoff Jul 7, 2025
85e1342
split notification models into 3 files and improve interval choices
Johnetordoff Jul 7, 2025
9a10a63
Merge branch 'develop' of https://github.com/CenterForOpenScience/osf…
Johnetordoff Jul 7, 2025
a50008c
add exception handling to /review_actions/ endpoint
antkryt Jul 8, 2025
f2e5309
clean-up tests and pass frequency data properly
Johnetordoff Jul 8, 2025
0471b76
update management commands and tests for notification migration
Johnetordoff Jul 8, 2025
686b581
Merge pull request #11211 from antkryt/feature/ENG-6135
adlius Jul 9, 2025
78e968c
Upgrade User Confirmation Registrations
Ostap-Zherebetskyi Jul 7, 2025
1affb5e
fix unit tests
Ostap-Zherebetskyi Jul 9, 2025
2dee1b2
Merge branch 'develop' of https://github.com/CenterForOpenScience/osf…
Johnetordoff Jul 9, 2025
72623cc
fix unit tests
Ostap-Zherebetskyi Jul 9, 2025
2da68ad
Merge remote-tracking branch 'upstream/refactor-notifications' into f…
Ostap-Zherebetskyi Jul 9, 2025
a02352c
fix unit tests
Ostap-Zherebetskyi Jul 9, 2025
2f45c6a
Merge pull request #11223 from antkryt/fix/ENG-8193
adlius Jul 9, 2025
ff9743b
fix unit tests
Ostap-Zherebetskyi Jul 9, 2025
feba563
fix unit tests
Ostap-Zherebetskyi Jul 10, 2025
90ef652
fix unit tests
Ostap-Zherebetskyi Jul 10, 2025
0c003f5
Merge branch 'develop' of https://github.com/CenterForOpenScience/osf…
Johnetordoff Jul 10, 2025
8743277
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jul 10, 2025
e3bc742
remove old management commands and add new ones to population notific…
Johnetordoff Jul 10, 2025
cd0bc26
Merge branch 'add-new-notifications-data-model' into feature/user_con…
Johnetordoff Jul 10, 2025
2dbcbf7
Merge branch 'develop' of https://github.com/CenterForOpenScience/osf…
Johnetordoff Jul 9, 2025
b0d8bdc
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jul 10, 2025
e47c9e8
Merge branch 'develop' of https://github.com/CenterForOpenScience/osf…
Johnetordoff Jul 9, 2025
37b419a
fix issues with migrate schema response task deletion
Johnetordoff Jul 10, 2025
0657c03
Merge branch 'add-new-notifications-data-model' into feature/user_con…
Johnetordoff Jul 11, 2025
03cad99
fix issues with migrate schema response task deletion
Johnetordoff Jul 11, 2025
4a4167f
Merge pull request #249 from Johnetordoff/feature/user_confirmation
Johnetordoff Jul 11, 2025
c37366c
Merge branch 'add-new-notifications-data-model' of github.com:johneto…
Johnetordoff Jul 11, 2025
b6bbeed
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jul 10, 2025
058f03b
Merge branch 'refactor-notifications' into add-new-notifications-data…
Johnetordoff Jul 11, 2025
f257fb6
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Jul 15, 2025
4c69f7e
Update notifications for withdraw and retraction types
Johnetordoff Jul 15, 2025
da9712f
clean-up user confirmation emails
Johnetordoff Jul 15, 2025
928d0c1
add file update notifications types
Johnetordoff Jul 15, 2025
ff0ba30
fix typo
Johnetordoff Jul 15, 2025
55e155d
add for institutional access emails
Johnetordoff Jul 15, 2025
6dbcdda
[ENG-8246] Fixed deletion of maintenance alerts in admin (#11226)
ihorsokhanexoft Jul 16, 2025
76f601c
[ENG-8325] Public column does not display the visibility status of ch…
ihorsokhanexoft Jul 16, 2025
95be0e0
API: Allow /v2/users/me/preprints list view to filter by title
ihorsokhanexoft Jul 16, 2025
cc51cb3
[ENG-8224] Fixed force archive template with registration addons (#11…
ihorsokhanexoft Jul 16, 2025
d43de2b
fix embargo sanctions typo
Johnetordoff Jul 16, 2025
99e26cb
add brand relationship to collectionprovider
Johnetordoff Jul 16, 2025
9776d92
fix mocks for institutional access tests
Johnetordoff Jul 16, 2025
cfc1f97
fix file added updates for notifications
Johnetordoff Jul 16, 2025
91672c0
Add collections scopes to FULL_READ and FULL_WRITE
futa-ikeda Jul 16, 2025
f235725
Merge pull request #11231 from futa-ikeda/collections-scopes
Johnetordoff Jul 17, 2025
2feec4a
add notification type emit for institutional requests
Johnetordoff Jul 16, 2025
f3965f7
add notification type emit for contributor added to provider for prep…
Johnetordoff Jul 17, 2025
19c838d
add external login link success notification type
Johnetordoff Jul 17, 2025
c1bfdf3
populate notification types in OSF Gather tests
Johnetordoff Jul 17, 2025
82cdfff
Merge pull request #11230 from Johnetordoff/add-brand-to-collection-p…
Johnetordoff Jul 17, 2025
a6e3ee8
update the file operations to use new notifications system
Johnetordoff Jul 17, 2025
79e82a1
add notifications admin and unit tests
Ostap-Zherebetskyi Jul 18, 2025
23a83c7
fix unit tests
Ostap-Zherebetskyi Jul 18, 2025
1177b1d
fix unit tests
Ostap-Zherebetskyi Jul 18, 2025
0d17c05
update more notifications to use NotificationType
Johnetordoff Jul 18, 2025
ccaf2c4
update crossref messages to new notification system
Johnetordoff Jul 18, 2025
d0f671f
update messages for primary_email and exports to new notification system
Johnetordoff Jul 18, 2025
ecb3696
clean-up mailhog and populate notification types code
Johnetordoff Jul 18, 2025
c2a7299
clean up contributor tests and save behavior for notifications
Johnetordoff Jul 21, 2025
7f3a668
[ENG-8936] API: Allow /v2/users/me/preprints list view to filter by t…
ihorsokhanexoft Jul 21, 2025
d0cf3c7
clean-up syntax for tests
Johnetordoff Jul 21, 2025
8c56b03
add Schema response to notificationTypes
Johnetordoff Jul 21, 2025
4db559a
add NotificationTypes for desk messages
Johnetordoff Jul 21, 2025
fd6e167
fix up draft registration tests
Johnetordoff Jul 21, 2025
1602dc9
simplify institutional access request notification code
Johnetordoff Jul 21, 2025
707f05c
fix categories for sendgrid emails (#11236)
antkryt Jul 21, 2025
b7c2e98
use NotificationType model for withdrawal requests
Johnetordoff Jul 21, 2025
8d6582f
fix preprint contributor notification tests and withdraw request noti…
Johnetordoff Jul 21, 2025
dcaf9bd
Add NotificationTypes for duplicate accounts
Johnetordoff Jul 21, 2025
918f6cf
fix notification tests for node and preprint requests
Johnetordoff Jul 22, 2025
7f6d5e9
[ENG-8401] Fixed preprint downloading (#11238)
ihorsokhanexoft Jul 22, 2025
189854c
[ENG-8216] Fixed children deletion on a node page in admin (#11237)
ihorsokhanexoft Jul 22, 2025
f756568
update email templates to support JSON event context
Johnetordoff Jul 22, 2025
ed5342c
add more provider notificationtypes
Johnetordoff Jul 22, 2025
b3ca1b8
fix up user claim message notification tests
Johnetordoff Jul 22, 2025
2ac9ef9
add bulk registration upload notifications to tests
Johnetordoff Jul 22, 2025
9815f1f
fix issues with notifications when adding nodes to instituions
Johnetordoff Jul 22, 2025
7c08559
fix issues with collection submissions notifications
Johnetordoff Jul 23, 2025
86a9466
fix reviewable and contributor notifications
Johnetordoff Jul 23, 2025
0e2f169
fix preprint versioning tests
Johnetordoff Jul 24, 2025
69b2d90
[ENG-7979] Registrations pending moderation that have components also…
antkryt Jul 24, 2025
0139a5f
update withdraw request declined notification
Johnetordoff Jul 24, 2025
a8084f1
added academiaInstitution in social-schema, fixed True value of 'ongo…
ihorsokhanexoft Jul 24, 2025
b21bf71
update registration detail
Johnetordoff Jul 24, 2025
7e96d6f
fix invite and institutional admin contributor tests
Johnetordoff Jul 25, 2025
7dc8375
clean up test_addons code
Johnetordoff Jul 25, 2025
fb6086b
fix up auth_views tests
Johnetordoff Jul 25, 2025
53b89ac
fix up contributor and desk notifications
Johnetordoff Jul 25, 2025
46b6944
deletes detect_duplicate notifications as that only applied to legacy…
Johnetordoff Jul 25, 2025
dcdbdc7
fix spam ban notification type and split up webtests into smaller files
Johnetordoff Jul 25, 2025
68b0494
more clean-up from self-CR
Johnetordoff Jul 25, 2025
d65288e
fix user claim and i forgot email notifications
Johnetordoff Jul 27, 2025
9501714
remove old notification mocking and simplify celery config
Johnetordoff Jul 27, 2025
8c6785a
update tasks for queued_email system
Johnetordoff Jul 27, 2025
3d80365
improve automatic subscription methods
Johnetordoff Jul 27, 2025
2e98358
remove child node subscription list
Johnetordoff Jul 27, 2025
38d7caa
refactor and fix mailhog tests
Johnetordoff Jul 28, 2025
ddd78d4
refactor add_contributors to use notification_type
Johnetordoff Jul 28, 2025
c89399f
remove _ensure_subscriptions
Johnetordoff Jul 28, 2025
bf99451
add draft_registration notificationtype for send_email
Johnetordoff Jul 28, 2025
1781656
upgrade institutional request access notification subscriptions
Johnetordoff Jul 28, 2025
75d6f45
fix archiver notifications
Johnetordoff Jul 28, 2025
9e8bd85
fix schema response tests
Johnetordoff Jul 28, 2025
b89846f
fix machine actions
Johnetordoff Jul 29, 2025
8e9126a
fix institution deactivation notifications
Johnetordoff Jul 29, 2025
61a072f
Merge remote-tracking branch 'upstream/develop' into feature/pbs-25-13
adlius Jul 29, 2025
5a8f453
Merge branch 'feature/pbs-25-13' of https://github.com/CenterForOpenS…
Johnetordoff Jul 29, 2025
df19159
fix preprint moderation
Johnetordoff Jul 29, 2025
ddd1cbb
update node contributor view to include preprints as resource
Johnetordoff Jul 29, 2025
c1c12bd
clean up file notification events
Johnetordoff Jul 29, 2025
7c79222
fix contributor email notifications with new throttle
Johnetordoff Jul 29, 2025
e04d901
remove old notification routes and routes
Johnetordoff Jul 29, 2025
b0d0521
fix addons logs
Johnetordoff Jul 29, 2025
d77eed2
clean up claim new user email throttle
Johnetordoff Jul 30, 2025
74f42bf
clean-up contributor throttle tests
Johnetordoff Jul 30, 2025
6eacd4d
fix reporter and preprint tests
Johnetordoff Jul 30, 2025
59c5c2f
fix throttle
Johnetordoff Jul 30, 2025
3c6dfa8
fix addons and campaign tests
Johnetordoff Jul 30, 2025
24c503b
fix schema response tests
Johnetordoff Jul 30, 2025
94734fd
clean-up sanction code
Johnetordoff Jul 30, 2025
51df115
remove mails and copy over subject lines
Johnetordoff Jul 30, 2025
5ec04a0
remove old comment based notification tests
Johnetordoff Jul 30, 2025
f281e99
remove mails.py
Johnetordoff Jul 31, 2025
dbf4815
fixing mailhog tests to use Django mail BE
Johnetordoff Jul 31, 2025
ebffbe4
more mails removal
Johnetordoff Jul 31, 2025
795a7e6
fix send grid code
Johnetordoff Jul 31, 2025
a90a234
fix more sanctions code
Johnetordoff Jul 31, 2025
8421403
fix more schema responses
Johnetordoff Jul 31, 2025
f9d4249
fix boa
Johnetordoff Jul 31, 2025
4c2d145
fix mock user
Johnetordoff Jul 31, 2025
8d9a26f
[ENG-8401] Earlier preprint versions download the current file (#11245)
ihorsokhanexoft Jul 31, 2025
7ccc8fb
fix schema response tests
Johnetordoff Jul 31, 2025
c418021
fix insti reporter tests
Johnetordoff Jul 31, 2025
57ba198
clean resource contributors create method
Johnetordoff Jul 31, 2025
8745da4
[ENG-8462] Institution setup fixes (#11241)
antkryt Jul 31, 2025
c635beb
remove logs groups embedding
Johnetordoff Jul 31, 2025
681a960
remove logs groups embedding
Johnetordoff Jul 31, 2025
9aed0ad
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Aug 1, 2025
bb1d1f5
re-expose quickfiles migrated logs
Johnetordoff Aug 1, 2025
519b710
mock mail for tests
Johnetordoff Aug 1, 2025
4c50c6c
fix mail mocking issues for password reset
Johnetordoff Aug 1, 2025
e228bd4
Merge branch 'feature/pbs-25-13' of https://github.com/CenterForOpenS…
Johnetordoff Aug 4, 2025
8bbe32f
Merge branch 'feature/digest_notifications_update' of github.com:john…
Johnetordoff Aug 4, 2025
40db424
Merge branch 'refactor-notifications' of https://github.com/CenterFor…
Johnetordoff Aug 4, 2025
496fc23
fix boa send_mail
Johnetordoff Aug 4, 2025
a73fb3a
remove old archiver test
Johnetordoff Aug 4, 2025
466685a
fix migrate management command
Johnetordoff Aug 4, 2025
a4e1fab
Merge branch 'feature/notifications_admin' of https://github.com/Osta…
Johnetordoff Aug 4, 2025
96db17a
refactor email subscriptions into separate tasks
Johnetordoff Aug 5, 2025
5993dad
improve digests by queuing emails with retry mechanism condensing ema…
Johnetordoff Aug 6, 2025
d2dd171
notifications DB optimization
Ostap-Zherebetskyi Aug 11, 2025
9658544
fix notification save
Ostap-Zherebetskyi Aug 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 34 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
ELASTICSEARCH6_ARCHIVE: elasticsearch-6.3.1.tar.gz
OSF_DB_PORT: 5432
OSF_DB_PASSWORD: postgres
GITHUB_ACTIONS: true

jobs:
build-cache:
Expand Down Expand Up @@ -167,3 +168,36 @@ jobs:
- name: Upload report
if: (success() || failure()) # run this step even if previous step failed
uses: ./.github/actions/gen-report

mailhog:
runs-on: ubuntu-22.04
permissions:
checks: write
needs: build-cache
services:
postgres:
image: postgres

env:
POSTGRES_PASSWORD: ${{ env.OSF_DB_PASSWORD }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025
- 8025:8025
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/start-build
- name: Run tests
run: poetry run python3 -m invoke test-ci-mailhog -n 1 --junit
- name: Upload report
if: (github.event_name != 'pull_request') && (success() || failure()) # run this step even if previous step failed
uses: ./.github/actions/gen-report
6 changes: 2 additions & 4 deletions README-docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,8 @@
docker compose run --rm web python3 -m scripts.parse_citation_styles
```
- Start ember_osf_web
- Needed for quickfiles feature:
```bash
docker compose up -d ember_osf_web
```
- Needed for ember app:
- `docker-compose up -d ember_osf_web`
- OPTIONAL: Register OAuth Scopes
- Needed for things such as the ember-osf dummy app
```bash
Expand Down
93 changes: 59 additions & 34 deletions addons/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from addons.base import exceptions as addon_errors
from addons.base.models import BaseStorageAddon
from addons.osfstorage.models import OsfStorageFile
from addons.osfstorage.models import OsfStorageFileNode
from addons.osfstorage.utils import enqueue_update_analytics

Expand All @@ -34,9 +33,7 @@
from framework.exceptions import HTTPError
from framework.flask import redirect
from framework.sentry import log_exception
from framework.routing import proxy_url
from framework.transactions.handlers import no_auto_transaction
from website import mails
from website import settings
from addons.base import signals as file_signals
from addons.base.utils import format_last_known_metadata, get_mfr_url
Expand All @@ -54,7 +51,7 @@
DraftRegistration,
Guid,
FileVersionUserMetadata,
FileVersion
FileVersion, NotificationType
)
from osf.metrics import PreprintView, PreprintDownload
from osf.utils import permissions
Expand Down Expand Up @@ -483,7 +480,7 @@ def _construct_payload(auth, resource, credentials, waterbutler_settings):

@must_be_signed
@no_auto_transaction
@must_be_valid_project(quickfiles_valid=True, preprints_valid=True)
@must_be_valid_project(preprints_valid=True)
def create_waterbutler_log(payload, **kwargs):
with transaction.atomic():
try:
Expand Down Expand Up @@ -578,20 +575,24 @@ def create_waterbutler_log(payload, **kwargs):
params=payload
)

if payload.get('email') is True or payload.get('errors'):
mails.send_mail(
user.username,
mails.FILE_OPERATION_FAILED if payload.get('errors')
else mails.FILE_OPERATION_SUCCESS,
action=payload['action'],
source_node=source_node,
destination_node=destination_node,
source_path=payload['source']['materialized'],
source_addon=payload['source']['addon'],
destination_addon=payload['destination']['addon'],
osf_support_email=settings.OSF_SUPPORT_EMAIL
if payload.get('email') or payload.get('errors'):
if payload.get('email'):
notification_type = NotificationType.Type.FILE_OPERATION_SUCCESS
if payload.get('errors'):
notification_type = NotificationType.Type.FILE_OPERATION_FAILED

NotificationType.objects.get(name=notification_type).emit(
user=user,
event_context={
'action': payload['action'],
'source_node': source_node,
'destination_node': destination_node,
'source_path': payload['source']['materialized'],
'source_addon': payload['source']['addon'],
'destination_addon': payload['destination']['addon'],
'osf_support_email': settings.OSF_SUPPORT_EMAIL
}
)

if payload.get('errors'):
# Action failed but our function succeeded
# Bail out to avoid file_signals
Expand All @@ -603,22 +604,52 @@ def create_waterbutler_log(payload, **kwargs):
metadata = payload.get('metadata') or payload.get('destination')

target_node = AbstractNode.load(metadata.get('nid'))
if target_node and not target_node.is_quickfiles and payload['action'] != 'download_file':
if target_node and payload['action'] != 'download_file':
update_storage_usage_with_size(payload)

with transaction.atomic():
file_signals.file_updated.send(target=node, user=user, event_type=action, payload=payload)
file_signals.file_updated.send(target=node, user=user, payload=payload)

with transaction.atomic():
match action:
case NotificationType.Type.FILE_ADDED:
notification = NotificationType.objects.get(name=NotificationType.Type.FILE_ADDED)
case NotificationType.Type.FILE_REMOVED:
notification = NotificationType.objects.get(name=NotificationType.Type.FILE_REMOVED)
case NotificationType.Type.FILE_UPDATED:
notification = NotificationType.objects.get(name=NotificationType.Type.FILE_UPDATED)
case NotificationType.Type.ADDON_FILE_RENAMED:
notification = NotificationType.objects.get(name=NotificationType.Type.ADDON_FILE_RENAMED)
case NotificationType.Type.ADDON_FILE_COPIED:
notification = NotificationType.objects.get(name=NotificationType.Type.ADDON_FILE_COPIED)
case NotificationType.Type.ADDON_FILE_REMOVED:
notification = NotificationType.objects.get(name=NotificationType.Type.ADDON_FILE_REMOVED)
case NotificationType.Type.ADDON_FILE_MOVED:
notification = NotificationType.objects.get(name=NotificationType.Type.ADDON_FILE_MOVED)
case _:
raise NotImplementedError(f'action {action} not implemented')

notification.emit(
user=user,
event_context={
'profile_image_url': user.profile_image_url(),
'localized_timestamp': str(timezone.now()),
'user_fullname': user.fullname,
'url': node.absolute_url,
}
)

return {'status': 'success'}


@file_signals.file_updated.connect
def addon_delete_file_node(self, target, user, event_type, payload):
def addon_delete_file_node(self, target, user, payload):
""" Get addon BaseFileNode(s), move it into the TrashedFileNode collection
and remove it from StoredFileNode.
Required so that the guids of deleted addon files are not re-pointed when an
addon file or folder is moved or renamed.
"""
event_type = payload['action']
if event_type == 'file_removed' and payload.get('provider', None) != 'osfstorage':
provider = payload['provider']
path = payload['metadata']['path']
Expand Down Expand Up @@ -1006,13 +1037,17 @@ def persistent_file_download(auth, **kwargs):
file = BaseFileNode.active.filter(_id=id_or_guid).first()
if not file:
guid = Guid.load(id_or_guid)
if guid:
file = guid.referent
else:
if not guid:
raise HTTPError(http_status.HTTP_404_NOT_FOUND, data={
'message_short': 'File Not Found',
'message_long': 'The requested file could not be found.'
})

file = guid.referent
if type(file) is Preprint:
referent, _ = Guid.load_referent(id_or_guid)
file = referent.primary_file

if not file.is_file:
raise HTTPError(http_status.HTTP_400_BAD_REQUEST, data={
'message_long': 'Downloading folders is not permitted.'
Expand All @@ -1032,16 +1067,6 @@ def persistent_file_download(auth, **kwargs):
)


def addon_view_or_download_quickfile(**kwargs):
fid = kwargs.get('fid', 'NOT_AN_FID')
file_ = OsfStorageFile.load(fid)
if not file_:
raise HTTPError(http_status.HTTP_404_NOT_FOUND, data={
'message_short': 'File Not Found',
'message_long': 'The requested file could not be found.'
})
return proxy_url(f'/project/{file_.target._id}/files/osfstorage/{fid}/')

def addon_view_file(auth, node, file_node, version):
# TODO: resolve circular import issue
from addons.wiki import settings as wiki_settings
Expand Down
67 changes: 36 additions & 31 deletions addons/boa/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
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
from osf.models import OSFUser, NotificationType
from osf.utils.fields import ensure_str, ensure_bytes
from website import settings as osf_settings
from website.mails import send_mail, ADDONS_BOA_JOB_COMPLETE, ADDONS_BOA_JOB_FAILURE

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -184,18 +183,21 @@ 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 <<<<<<<<')
await sync_to_async(send_mail)(
to_addr=user.username,
mail=ADDONS_BOA_JOB_COMPLETE,
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,
NotificationType.objects.get(
name=NotificationType.Type.ADDONS_BOA_JOB_COMPLETE
).emit(
user=user,
event_context={
'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,22 +211,25 @@ def handle_boa_error(message, code, username, fullname, project_url, query_file_
sentry.log_message(message, skip_session=True)
except Exception:
pass
send_mail(
to_addr=username,
mail=ADDONS_BOA_JOB_FAILURE,
fullname=fullname,
code=code,
message=message,
query_file_name=query_file_name,
file_size=file_size,
max_file_size=boa_settings.MAX_SUBMISSION_SIZE,
query_file_full_path=query_file_full_path,
output_file_name=output_file_name,
job_id=job_id,
max_job_wait_hours=boa_settings.MAX_JOB_WAITING_TIME / 3600,
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,
NotificationType.objects.get(
name=NotificationType.Type.ADDONS_BOA_JOB_FAILURE
).emit(
destination_address=username,
event_context={
'fullname': fullname,
'code': code,
'query_file_name': query_file_name,
'file_size': file_size,
'max_file_size': boa_settings.MAX_SUBMISSION_SIZE,
'query_file_full_path': query_file_full_path,
'output_file_name': output_file_name,
'job_id': job_id,
'max_job_wait_hours': boa_settings.MAX_JOB_WAITING_TIME / 3600,
'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 code
58 changes: 21 additions & 37 deletions addons/boa/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
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_tests.factories import AuthUserFactory, ProjectFactory
from tests.base import OsfTestCase
from tests.utils import capture_notifications
from website import settings as osf_settings
from website.mails import ADDONS_BOA_JOB_COMPLETE, ADDONS_BOA_JOB_FAILURE

DEFAULT_REFRESH_JOB_INTERVAL = boa_settings.REFRESH_JOB_INTERVAL
DEFAULT_MAX_JOB_WAITING_TIME = boa_settings.MAX_JOB_WAITING_TIME
Expand Down Expand Up @@ -53,42 +54,25 @@ def test_boa_error_code(self):
assert BoaErrorCode.JOB_TIME_OUT_ERROR == 7

def test_handle_boa_error(self):
with mock.patch('addons.boa.tasks.send_mail', return_value=None) as mock_send_mail, \
mock.patch('addons.boa.tasks.sentry.log_message', return_value=None) as mock_sentry_log_message, \
mock.patch('addons.boa.tasks.logger.error', return_value=None) as mock_logger_error:
return_value = handle_boa_error(
self.error_message,
BoaErrorCode.UNKNOWN,
self.user_username,
self.user_fullname,
self.project_url,
self.file_full_path,
query_file_name=self.query_file_name,
file_size=self.file_size,
output_file_name=self.output_file_name,
job_id=self.job_id
)
mock_send_mail.assert_called_with(
to_addr=self.user_username,
mail=ADDONS_BOA_JOB_FAILURE,
fullname=self.user_fullname,
code=BoaErrorCode.UNKNOWN,
message=self.error_message,
query_file_name=self.query_file_name,
file_size=self.file_size,
max_file_size=boa_settings.MAX_SUBMISSION_SIZE,
query_file_full_path=self.file_full_path,
output_file_name=self.output_file_name,
job_id=self.job_id,
max_job_wait_hours=self.max_job_wait_hours,
project_url=self.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,
)
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
with mock.patch('addons.boa.tasks.sentry.log_message', return_value=None) as mock_sentry_log_message:
with mock.patch('addons.boa.tasks.logger.error', return_value=None) as mock_logger_error:
with capture_notifications() as notifications:
return_value = handle_boa_error(
self.error_message,
BoaErrorCode.UNKNOWN,
self.user_username,
self.user_fullname,
self.project_url,
self.file_full_path,
file_size=self.file_size,
output_file_name=self.output_file_name,
job_id=self.job_id
)
assert len(notifications) == 1
assert notifications[0]['type'] == NotificationType.Type.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


class TestSubmitToBoa(OsfTestCase):
Expand Down
2 changes: 1 addition & 1 deletion addons/osfstorage/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from framework.auth import cas

from osf import features
from osf.models import Tag, QuickFilesNode
from osf.models import Tag
from osf.models import files as models
from addons.osfstorage.apps import osf_storage_root
from addons.osfstorage import utils
Expand Down
Loading