Skip to content

Commit 5e29285

Browse files
[ENG-8996] Fix moderator digest (#11319)
* Fix moderator digest * Fix unit tests
1 parent 0ae75d0 commit 5e29285

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

notifications/listeners.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def reviews_withdraw_requests_notification_moderators(self, timestamp, context,
6767
from osf.models import NotificationType
6868

6969
provider = resource.provider
70+
context['provider_id'] = provider.id
7071
# Set message
7172
context['message'] = f'has requested withdrawal of "{resource.title}".'
7273
# Set submission url

notifications/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ def send_moderator_email_task(self, user_id, provider_id, notification_ids, **kw
155155
'user_fullname': user.fullname,
156156
'can_change_preferences': False,
157157
'notification_settings_url': notification_settings_url,
158-
'withdrawals_url': withdrawals_url,
159-
'submissions_url': submissions_url,
158+
'reviews_withdrawal_url': withdrawals_url,
159+
'reviews_submissions_url': submissions_url,
160160
'provider_type': provider_type,
161161
'additional_context': additional_context,
162162
'is_admin': provider.get_group(ADMIN).user_set.filter(id=user.id).exists()

osf/models/collection_submission.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def _notify_moderators_pending(self, event_data):
139139
user=user,
140140
subscribed_object=self.guid.referent,
141141
event_context={
142+
'provider_id': self.collection.provider.id,
142143
'submitter_fullname': self.creator.fullname,
143144
'requester_fullname': event_data.kwargs.get('user').fullname,
144145
'requester_contributor_names': ''.join(self.guid.referent.contributors.values_list('fullname', flat=True)),

website/reviews/listeners.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def reviews_withdraw_requests_notification_moderators(self, timestamp, context,
3131
context['message'] = f'has requested withdrawal of "{resource.title}".'
3232
context['reviews_submission_url'] = f'{DOMAIN}reviews/registries/{provider._id}/{resource._id}'
3333

34+
context['provider_id'] = provider.id
3435
for recipient in provider.get_group('moderator').user_set.all():
3536
context['user_fullname'] = recipient.fullname
3637
context['recipient_fullname'] = recipient.fullname
@@ -54,6 +55,7 @@ def reviews_withdrawal_requests_notification(self, timestamp, context):
5455
context['message'] = f'has requested withdrawal of the {preprint_word} "{preprint.title}".'
5556
context['reviews_submission_url'] = f'{DOMAIN}reviews/preprints/{preprint.provider._id}/{preprint._id}'
5657

58+
context['provider_id'] = preprint.provider.id
5759
for recipient in preprint.provider.get_group('moderator').user_set.all():
5860
context['user_fullname'] = recipient.fullname
5961
context['recipient_fullname'] = recipient.fullname
@@ -73,6 +75,7 @@ def reviews_submit_notification_moderators(self, timestamp, resource, context):
7375
# imports moved here to avoid AppRegistryNotReady error
7476

7577
provider = resource.provider
78+
context['provider_id'] = provider.id
7679
context['reviews_submission_url'] = (
7780
f'{DOMAIN}reviews/preprints/{provider._id}/{resource._id}'
7881
)

website/templates/digest_reviews_moderators.html.mako

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<tr>
1818
<th colspan="2" style="padding: 0px 15px 0 15px">
1919
<h3 style="padding: 0 15px 5px 15px; margin: 30px 0 0 0;border: none;list-style: none;font-weight: 300; border-bottom: 1px solid #eee; text-align: left;">
20-
Hello ${name},
20+
Hello ${user_fullname},
2121
<p>
2222
Below are the recent submissions
2323
% if reviews_withdrawal_url:
@@ -39,7 +39,7 @@
3939
<tr>
4040
<td style="border-collapse: collapse;">
4141
%for item in d:
42-
${item['message']}
42+
${item}
4343
%endfor
4444
</td>
4545
</tr>
@@ -55,7 +55,7 @@
5555
</tr>
5656
<tr>
5757
<td style="border-collapse: collapse;">
58-
${build_message(message)}
58+
${build_message(notifications)}
5959
</td>
6060
</tr>
6161
</%def>

0 commit comments

Comments
 (0)