From df34b8c6b1a792cd9c570b92948df9a47ad3c4ac Mon Sep 17 00:00:00 2001 From: Matt Frazier Date: Wed, 22 Nov 2023 15:50:49 -0500 Subject: [PATCH 1/5] Update ReviewActionListCreate write scopes --- api/actions/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/actions/views.py b/api/actions/views.py index 2c7276873fac..be0f47a0a8db 100644 --- a/api/actions/views.py +++ b/api/actions/views.py @@ -159,7 +159,7 @@ class ReviewActionListCreate(JSONAPIBaseView, generics.ListCreateAPIView, ListFi ) required_read_scopes = [CoreScopes.ACTIONS_READ] - required_write_scopes = [CoreScopes.NULL] + required_write_scopes = [CoreScopes.ACTIONS_WRITE] parser_classes = (JSONAPIMultipleRelationshipsParser, JSONAPIMultipleRelationshipsParserForRegularJSON,) serializer_class = ReviewActionSerializer From 207de84f9b8a3361f62f2662ac7f5755f732793a Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Wed, 1 Nov 2023 10:46:01 -0400 Subject: [PATCH 2/5] Routing changes for Preprints Modernization - Phase 1 --- api/base/serializers.py | 3 +++ website/routes.py | 13 ++++++++++--- website/views.py | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/api/base/serializers.py b/api/base/serializers.py index c21c76dc3946..c8cdff04c7ee 100644 --- a/api/base/serializers.py +++ b/api/base/serializers.py @@ -915,6 +915,9 @@ def to_representation(self, value): or related_class.view_name == 'registration-citation': related_id = resolved_url.kwargs['node_id'] related_type = 'citation' + elif related_class.view_name == 'preprint-citation': + related_id = resolved_url.kwargs['preprint_id'] + related_type = 'citation' elif related_type in ('preprint_providers', 'preprint-providers', 'registration-providers'): related_id = resolved_url.kwargs['provider_id'] elif related_type in ('registrations', 'draft_nodes'): diff --git a/website/routes.py b/website/routes.py index 6634c6a97f5b..787fe2e367bc 100644 --- a/website/routes.py +++ b/website/routes.py @@ -260,9 +260,16 @@ def ember_app(path=None): for k in EXTERNAL_EMBER_APPS.keys(): if request.path.strip('/').startswith(k): ember_app = EXTERNAL_EMBER_APPS[k] - if k == 'preprints' and request.path.rstrip('/').endswith('discover'): - # Route preprint discover pages to new search page in EOW - ember_app = EXTERNAL_EMBER_APPS.get('ember_osf_web', False) or ember_app + if k == 'preprints': + if request.path.rstrip('/').endswith('edit'): + # Route preprint edit pages to old preprint app + ember_app = EXTERNAL_EMBER_APPS.get('preprints', False) or ember_app + elif request.path.rstrip('/').endswith('submit'): + # Route preprint submit pages to old preprint app + ember_app = EXTERNAL_EMBER_APPS.get('preprints', False) or ember_app + else: + # Route other preprint pages to EOW + ember_app = EXTERNAL_EMBER_APPS.get('ember_osf_web', False) or ember_app break if not ember_app: diff --git a/website/views.py b/website/views.py index c3051861791b..a8f704210699 100644 --- a/website/views.py +++ b/website/views.py @@ -332,7 +332,9 @@ def resolve_guid(guid, suffix=None): if isinstance(resource, Preprint): if resource.provider.domain_redirect_enabled: return redirect(resource.absolute_url, http_status.HTTP_301_MOVED_PERMANENTLY) - return stream_emberapp(EXTERNAL_EMBER_APPS['preprints']['server'], preprints_dir) + if clean_suffix.endswith('edit'): + return stream_emberapp(EXTERNAL_EMBER_APPS['preprints']['server'], preprints_dir) + return use_ember_app() elif isinstance(resource, Registration) and (clean_suffix in ('', 'comments', 'links', 'components', 'resources',)) and waffle.flag_is_active(request, features.EMBER_REGISTRIES_DETAIL_PAGE): return use_ember_app() From b69ab6528810de5afe47aebafd53aed7a941b4f5 Mon Sep 17 00:00:00 2001 From: Matt Frazier Date: Thu, 30 Nov 2023 13:03:17 -0500 Subject: [PATCH 3/5] Fix ResolveGuid tests --- tests/test_views.py | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/tests/test_views.py b/tests/test_views.py index 920d46a0d07c..f1a8c1966cec 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -5018,28 +5018,22 @@ class TestResolveGuid(OsfTestCase): def setUp(self): super(TestResolveGuid, self).setUp() - def test_preprint_provider_without_domain(self): + @mock.patch('website.views.use_ember_app') + def test_preprint_provider_without_domain(self, mock_use_ember_app): provider = PreprintProviderFactory(domain='') preprint = PreprintFactory(provider=provider) url = web_url_for('resolve_guid', _guid=True, guid=preprint._id) res = self.app.get(url) - assert_equal(res.status_code, 200) - assert_equal( - res.request.path, - '/{}/'.format(preprint._id) - ) + mock_use_ember_app.assert_called_with() - def test_preprint_provider_with_domain_without_redirect(self): + @mock.patch('website.views.use_ember_app') + def test_preprint_provider_with_domain_without_redirect(self, mock_use_ember_app): domain = 'https://test.com/' provider = PreprintProviderFactory(_id='test', domain=domain, domain_redirect_enabled=False) preprint = PreprintFactory(provider=provider) url = web_url_for('resolve_guid', _guid=True, guid=preprint._id) res = self.app.get(url) - assert_equal(res.status_code, 200) - assert_equal( - res.request.path, - '/{}/'.format(preprint._id) - ) + mock_use_ember_app.assert_called_with() def test_preprint_provider_with_domain_with_redirect(self): domain = 'https://test.com/' @@ -5062,16 +5056,13 @@ def test_preprint_provider_with_domain_with_redirect(self): - def test_preprint_provider_with_osf_domain(self): + @mock.patch('website.views.use_ember_app') + def test_preprint_provider_with_osf_domain(self, mock_use_ember_app): provider = PreprintProviderFactory(_id='osf', domain='https://osf.io/') preprint = PreprintFactory(provider=provider) url = web_url_for('resolve_guid', _guid=True, guid=preprint._id) res = self.app.get(url) - assert_equal(res.status_code, 200) - assert_equal( - res.request.path, - '/{}/'.format(preprint._id) - ) + mock_use_ember_app.assert_called_with() class TestConfirmationViewBlockBingPreview(OsfTestCase): From 7810a1e86ac520d5ea1ca54a0b91ab58040f69ad Mon Sep 17 00:00:00 2001 From: John Tordoff <> Date: Mon, 20 Nov 2023 15:06:06 -0500 Subject: [PATCH 4/5] Add AGU Conference campaign --- framework/auth/campaigns.py | 9 +++++++ tests/test_campaigns.py | 1 + website/mails/mails.py | 4 +++ .../confirm_agu_conference_2024.html.mako | 25 +++++++++++++++++++ website/util/metrics.py | 1 + 5 files changed, 40 insertions(+) create mode 100644 website/templates/emails/confirm_agu_conference_2024.html.mako diff --git a/framework/auth/campaigns.py b/framework/auth/campaigns.py index 64552a8f5efe..9d418e863e05 100644 --- a/framework/auth/campaigns.py +++ b/framework/auth/campaigns.py @@ -91,6 +91,15 @@ def get_campaigns(): } }) + newest_campaigns.update({ + 'agu_conference_2023': { + 'system_tag': CampaignSourceTags.AguConference2023.value, + 'redirect_url': '', + 'confirmation_email_template': mails.CONFIRM_EMAIL_AGU_CONFERENCE_2023, + 'login_type': 'native', + } + }) + CAMPAIGNS = newest_campaigns CAMPAIGNS_LAST_REFRESHED = timezone.now() diff --git a/tests/test_campaigns.py b/tests/test_campaigns.py index 442d1d1f9314..66cb7f348dba 100644 --- a/tests/test_campaigns.py +++ b/tests/test_campaigns.py @@ -44,6 +44,7 @@ def setUp(self): 'psyarxiv-preprints', 'osf-registries', 'osf-registered-reports', + 'agu_conference_2023', ] self.refresh = timezone.now() campaigns.CAMPAIGNS = None # force campaign refresh now that preprint providers are populated diff --git a/website/mails/mails.py b/website/mails/mails.py index d0263c59f95e..4ecb438a7e80 100644 --- a/website/mails/mails.py +++ b/website/mails/mails.py @@ -188,6 +188,10 @@ def get_english_article(word): 'confirm_erpc', subject='OSF Account Verification, Election Research Preacceptance Competition' ) +CONFIRM_EMAIL_AGU_CONFERENCE_2023 = Mail( + 'confirm_agu_conference_2023', + subject='OSF Account Verification, from the American Geophysical Union Conference' +) CONFIRM_EMAIL_PREPRINTS = lambda name, provider: Mail( 'confirm_preprints_{}'.format(name), subject='OSF Account Verification, {}'.format(provider) diff --git a/website/templates/emails/confirm_agu_conference_2024.html.mako b/website/templates/emails/confirm_agu_conference_2024.html.mako new file mode 100644 index 000000000000..6d61636068cf --- /dev/null +++ b/website/templates/emails/confirm_agu_conference_2024.html.mako @@ -0,0 +1,25 @@ +<%inherit file="notify_base.mako" /> + +<%def name="content()"> + + + Hello ${user.fullname},
+
+ + Thank you for joining us at the AGU Open Science Pavilion, and welcome to the Open Science Framework. + + We are pleased to offer a special AGU attendees exclusive community call to continue our conversation and to help + you get oriented on the OSF. This is an opportunity for us to show you useful OSF features, talk about + open science in your domains, and for you to ask any questions you may have. + You can register for this free event here: +
+ https://cos-io.zoom.us/meeting/register/tZAuceCvrjotHNG3n6XzLFDv1Rnn2hkjczHr +
+ To continue, please verify your email address by visiting this link:
+
+ ${confirmation_url}
+
+ From the team at the Center for Open Science
+ + + diff --git a/website/util/metrics.py b/website/util/metrics.py index 4416b4f5cd47..19c9773e9350 100644 --- a/website/util/metrics.py +++ b/website/util/metrics.py @@ -49,6 +49,7 @@ class CampaignSourceTags(Enum): ErpChallenge = campaign_source_tag('erp_challenge') OsfRegisteredReports = campaign_source_tag('osf_registered_reports') Osf4m = campaign_source_tag('osf4m') + AguConference2023 = campaign_source_tag('agu_conference_2023') class OsfClaimedTags(Enum): From 9e0322d9ba888900a9fdc04b794af9abd50b0ad0 Mon Sep 17 00:00:00 2001 From: Matt Frazier Date: Tue, 28 Nov 2023 18:18:35 -0500 Subject: [PATCH 5/5] Rename, reword template - Fix redirect --- framework/auth/campaigns.py | 2 +- ...e_2024.html.mako => confirm_agu_conference_2023.html.mako} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename website/templates/emails/{confirm_agu_conference_2024.html.mako => confirm_agu_conference_2023.html.mako} (88%) diff --git a/framework/auth/campaigns.py b/framework/auth/campaigns.py index 9d418e863e05..95203e058ca4 100644 --- a/framework/auth/campaigns.py +++ b/framework/auth/campaigns.py @@ -94,7 +94,7 @@ def get_campaigns(): newest_campaigns.update({ 'agu_conference_2023': { 'system_tag': CampaignSourceTags.AguConference2023.value, - 'redirect_url': '', + 'redirect_url': furl.furl(DOMAIN).add(path='dashboard/').url, 'confirmation_email_template': mails.CONFIRM_EMAIL_AGU_CONFERENCE_2023, 'login_type': 'native', } diff --git a/website/templates/emails/confirm_agu_conference_2024.html.mako b/website/templates/emails/confirm_agu_conference_2023.html.mako similarity index 88% rename from website/templates/emails/confirm_agu_conference_2024.html.mako rename to website/templates/emails/confirm_agu_conference_2023.html.mako index 6d61636068cf..429ec9114108 100644 --- a/website/templates/emails/confirm_agu_conference_2024.html.mako +++ b/website/templates/emails/confirm_agu_conference_2023.html.mako @@ -14,8 +14,8 @@ You can register for this free event here:
https://cos-io.zoom.us/meeting/register/tZAuceCvrjotHNG3n6XzLFDv1Rnn2hkjczHr -
- To continue, please verify your email address by visiting this link:
+

+ To confirm your OSF account, please verify your email address by visiting this link:

${confirmation_url}