Skip to content

Commit f27ec43

Browse files
committed
fix template tests
1 parent efee288 commit f27ec43

15 files changed

+45
-37
lines changed

api/institutions/authentication.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ def authenticate(self, request):
355355
).emit(
356356
user=user,
357357
event_context={
358+
'user_fullname': user.fullname,
358359
'email_to_add': email_to_add,
359360
'domain': DOMAIN,
360361
'osf_support_email': OSF_SUPPORT_EMAIL,

api/nodes/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,7 @@ def perform_create(self, serializer):
10511051
user=user,
10521052
subscribed_object=node,
10531053
event_context={
1054+
'domain': settings.DOMAIN,
10541055
'guid': fork._id,
10551056
'node_title': node.title,
10561057
'node__id': node._id,
@@ -1065,6 +1066,7 @@ def perform_create(self, serializer):
10651066
user=user,
10661067
subscribed_object=node,
10671068
event_context={
1069+
'domain': settings.DOMAIN,
10681070
'guid': fork._id,
10691071
'node_title': node.title,
10701072
'node__id': node._id,

api/requests/serializers.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,18 @@ def make_node_institutional_access_request(self, node, validated_data) -> NodeRe
193193
user=recipient,
194194
message_frequency='instantly',
195195
event_context={
196-
'sender': sender.username,
197-
'bcc_addr': [sender.username] if validated_data['bcc_sender'] else None,
198-
'reply_to': sender.username if validated_data['reply_to'] else None,
199-
'recipient': recipient.username if recipient else None,
196+
'sender_fullname': sender.fullname,
197+
'sender_absolute_url': sender.absolute_url,
198+
'recipient_fullname': recipient.username if recipient else None,
200199
'comment': comment,
201-
'institution': institution.id if institution else None,
200+
'institution_name': institution.name if institution else None,
202201
'osf_url': settings.DOMAIN,
203202
'node': node_request.target._id,
204203
},
204+
email_context={
205+
'bcc_addr': [sender.username] if validated_data['bcc_sender'] else None,
206+
'reply_to': sender.username if validated_data['reply_to'] else None,
207+
},
205208
)
206209

207210
return node_request

osf_tests/metadata/test_osf_gathering.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ def setUpTestData(cls):
101101
creator=cls.user__admin,
102102
is_public=True,
103103
)
104-
cls.preprint.add_contributor(cls.user__readwrite, permissions=permissions.WRITE)
105-
cls.preprint.add_contributor(cls.user__readonly, permissions=permissions.READ)
106-
cls.preprint.add_contributor(cls.user__invisible, permissions=permissions.WRITE, visible=False)
104+
cls.preprint.add_contributor(cls.user__readwrite, permissions=permissions.WRITE, notification_type=False)
105+
cls.preprint.add_contributor(cls.user__readonly, permissions=permissions.READ, notification_type=False)
106+
cls.preprint.add_contributor(cls.user__invisible, permissions=permissions.WRITE, visible=False, notification_type=False)
107107
cls.registration_cedar_record = factories.CedarMetadataRecordFactory(
108108
template=cls.cedar_template,
109109
is_published=True,

website/project/views/contributor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,8 @@ def notify_added_contributor(node, contributor, notification_type, auth=None, *a
638638
'domain': settings.DOMAIN,
639639
'is_initiator': getattr(getattr(auth, 'user', None), 'id', None) == contributor.id if auth else False,
640640
'branded_service': getattr(getattr(node, 'provider', None), 'id', None),
641+
'branded_service_name': getattr(getattr(node, 'provider', None), 'name', None),
642+
'branded_service_preprint_word': getattr(getattr(node, 'provider', None), 'preprint_word', None),
641643
'node_title': node.title,
642644
'node_id': node._id,
643645
'node_provider__id': getattr(node.provider, '_id', None),

website/templates/emails/collection_submission_cancel.html.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
was canceled. If you wish to be associated with the collection, you will need to request to be added again.
1717
% else:
18-
<a href="${remover_absolute_url}">${remover.fullname}</a> canceled the request to add
18+
<a href="${remover_absolute_url}">${remover_fullname}</a> canceled the request to add
1919
<a href="${node_absolute_url}">${node_title}</a>to
2020
% if collection.provider:
2121
<a href="${collections_link}">${collection_provider_name}</a>

website/templates/emails/confirm_merge.html.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<%def name="content()">
44
<tr>
55
<td style="border-collapse: collapse;">
6-
Hello ${merge_target.fullname},<br>
6+
Hello ${merge_target_fullname},<br>
77
<br>
88
This email is to notify you that ${user_username} has initiated an account merge with your account on the Open Science Framework (OSF). This merge will move all of the projects and components associated with ${email} and with ${user_username} into one account. All projects and components will be displayed under ${user.username}.<br>
99
<br>

website/templates/emails/confirm_moderation.html.mako

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
<td style="border-collapse: collapse;">
66
Hello ${user_fullname},<br>
77
<br>
8-
You have been added by ${referrer_fullname}, as ${'an administrator' if is_admin else 'a moderator'} to ${provider.name}, powered by OSF. To set a password for your account, visit:<br>
8+
You have been added by ${referrer_fullname}, as ${'an administrator' if is_admin else 'a moderator'} to ${provider_name}, powered by OSF. To set a password for your account, visit:<br>
99
<br>
1010
${claim_url}<br>
1111
<br>
12-
Once you have set a password you will be able to moderate, create and approve your own submissions. You will automatically be subscribed to notification emails for new submissions to ${provider.name}.<br>
12+
Once you have set a password you will be able to moderate, create and approve your own submissions. You will automatically be subscribed to notification emails for new submissions to ${provider_name}.<br>
1313
<br>
14-
If you are not ${user_fullname} or you have been erroneously associated with ${provider.name}, email contact+${provider._id}@osf.io with the subject line "Claiming error" to report the problem.<br>
14+
If you are not ${user_fullname} or you have been erroneously associated with ${provider_name}, email contact+${provider__id}@osf.io with the subject line "Claiming error" to report the problem.<br>
1515
<br>
1616
Sincerely,<br>
17-
Your ${provider.name} and OSF teams<br>
17+
Your ${provider_name} and OSF teams<br>
1818
</tr>
1919
</%def>

website/templates/emails/contributor_added_preprint_node_from_osf.html.mako

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<td style="border-collapse: collapse;">
66
Hello ${user_fullname},<br>
77
<br>
8-
${referrer_text} as a contributor to the project "${node.title}" on the Open Science Framework: ${node.absolute_url}<br>
8+
${referrer_text} as a contributor to the project "${node_title}" on the Open Science Framework: ${node_absolute_url}<br>
99
<br>
1010
This project also contains the supplemental files for the following preprint(s):
1111
<br>
@@ -15,7 +15,7 @@
1515
% endfor
1616
</ul>
1717
<br>
18-
If you are erroneously being associated with "${node.title}," then you may visit the project's "Contributors" page and remove yourself as a contributor.<br>
18+
If you are erroneously being associated with "${node_title}," then you may visit the project's "Contributors" page and remove yourself as a contributor.<br>
1919
<br>
2020
Sincerely,<br>
2121
<br>

website/templates/emails/contributor_added_preprints.html.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<td style="border-collapse: collapse;">
66
Hello ${user_fullname},<br>
77
<br>
8-
${referrer_text} as a contributor to the ${branded_service.preprint_word} "${node_title}" on ${branded_service_name}, which is hosted on the Open Science Framework: ${node.absolute_url}<br>
8+
${referrer_text} as a contributor to the ${branded_service_preprint_word} "${node_title}" on ${branded_service_name}, which is hosted on the Open Science Framework: ${node_absolute_url}<br>
99
<br>
1010
If you have been erroneously associated with "${node_title}", then you may visit the ${branded_service_preprint_word} and remove yourself as a contributor.<br>
1111
<br>

0 commit comments

Comments
 (0)