diff --git a/api_tests/requests/views/test_node_request_list.py b/api_tests/requests/views/test_node_request_list.py index f94d3b4acf2..b49e2840816 100644 --- a/api_tests/requests/views/test_node_request_list.py +++ b/api_tests/requests/views/test_node_request_list.py @@ -80,7 +80,7 @@ def test_requests_disabled_list(self, app, url, create_payload, project, admin): res = app.get(url, create_payload, auth=admin.auth, expect_errors=True) assert res.status_code == 403 - @mock.patch('website.mails.mails.send_mail') + @mock.patch('website.mails.send_mail') def test_email_sent_to_all_admins_on_submit(self, mock_mail, app, project, noncontrib, url, create_payload, second_admin): project.is_public = True project.save() @@ -88,7 +88,7 @@ def test_email_sent_to_all_admins_on_submit(self, mock_mail, app, project, nonco assert res.status_code == 201 assert mock_mail.call_count == 2 - @mock.patch('website.mails.mails.send_mail') + @mock.patch('website.mails.send_mail') def test_email_not_sent_to_parent_admins_on_submit(self, mock_mail, app, project, noncontrib, url, create_payload, second_admin): component = NodeFactory(parent=project, creator=second_admin) component.is_public = True diff --git a/osf/utils/machines.py b/osf/utils/machines.py index 9687e19749d..ac63b1b7894 100644 --- a/osf/utils/machines.py +++ b/osf/utils/machines.py @@ -226,15 +226,15 @@ def notify_submit(self, ev): context = self.get_context() context['contributors_url'] = f'{self.machineable.target.absolute_url}contributors/' context['project_settings_url'] = f'{self.machineable.target.absolute_url}settings/' - - for admin in self.machineable.target.get_users_with_perm(permissions.ADMIN): - mails.send_mail( - admin.username, - mails.ACCESS_REQUEST_SUBMITTED, - admin=admin, - osf_contact_email=OSF_CONTACT_EMAIL, - **context - ) + if not self.machineable.request_type == NodeRequestTypes.INSTITUTIONAL_REQUEST.value: + for admin in self.machineable.target.get_users_with_perm(permissions.ADMIN): + mails.send_mail( + admin.username, + mails.ACCESS_REQUEST_SUBMITTED, + admin=admin, + osf_contact_email=OSF_CONTACT_EMAIL, + **context + ) def notify_resubmit(self, ev): """ Notify admins that someone is requesting access again