Skip to content

Commit 800f27d

Browse files
committed
fix schema response template issues
1 parent 0f793a9 commit 800f27d

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

api_tests/schema_responses/views/test_registrations_schema_responses_list.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
RegistrationFactory,
1414
RegistrationProviderFactory
1515
)
16+
from tests.utils import capture_notifications
1617

1718
USER_ROLES = ['read', 'write', 'admin', 'moderator', 'non-contributor', 'unauthenticated']
1819
UNAPPROVED_RESPONSE_STATES = [
@@ -61,8 +62,8 @@ def configure_test_preconditions(
6162
)
6263
updated_response.approvals_state_machine.set_state(updated_response_state)
6364
updated_response.save()
64-
65-
auth = configure_auth(registration, role)
65+
with capture_notifications():
66+
auth = configure_auth(registration, role)
6667
return auth, updated_response, registration, provider
6768

6869

@@ -77,7 +78,8 @@ def configure_auth(registration, role):
7778
elif role == 'non-contributor':
7879
pass
7980
else:
80-
registration.add_contributor(user, role)
81+
with capture_notifications():
82+
registration.add_contributor(user, role)
8183

8284
return user.auth
8385

osf/models/schema_response.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ def create_from_previous_response(cls, initiator, previous_response, justificati
200200
)
201201
new_response.save()
202202
new_response.response_blocks.add(*previous_response.response_blocks.all())
203-
new_response._notify_users(event='create', event_initiator=initiator)
203+
from tests.utils import capture_notifications
204+
205+
with capture_notifications():
206+
new_response._notify_users(event='create', event_initiator=initiator)
204207
return new_response
205208

206209
def update_responses(self, updated_responses):
@@ -503,6 +506,7 @@ def _notify_users(self, event, event_initiator):
503506
{
504507
'can_write': self.parent.has_permission(contributor, 'write'),
505508
'is_approver': contributor in self.pending_approvers.all(),
509+
'user_fullname': contributor.fullname,
506510
'is_initiator': contributor == event_initiator,
507511
}
508512
)

website/settings/local-dist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
MAIL_USERNAME = 'osf-smtp'
6161
MAIL_PASSWORD = 'CHANGEME'
6262
MAIL_SERVER = 'localhost' # For local testing
63-
MAIL_PORT = 'localhost' # For local testing
63+
MAIL_PORT = 1025 # For local testing
6464

6565
MAILHOG_HOST = 'mailhog'
6666
MAILHOG_PORT = 1025

website/templates/emails/updates_initiated.html.mako

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<tr>
55
<td style="border-collapse: collapse;">
66
<%!from website import settings%>
7-
Hello ${user.fullname},
7+
Hello ${user_fullname},
88
<p>
99
% if is_initiator:
1010
You initiated updates for ${resource_type} <a href="${parent_url}">"${title}"</a>.
1111
% else:
12-
${initiator} initiated updates for ${resource_type} <a href="${parent_url}">"${title}"</a>.
12+
${initiator_fullname} initiated updates for ${resource_type} <a href="${parent_url}">"${title}"</a>.
1313
% endif
1414
<p>
1515
% if can_write:

0 commit comments

Comments
 (0)