|
1 | 1 | import logging |
2 | 2 |
|
3 | 3 | from django.apps import apps |
4 | | -from django.utils import timezone |
5 | 4 |
|
6 | 5 | from website.project.signals import contributor_added, project_created, node_deleted, contributor_removed |
7 | 6 | from website.reviews import signals as reviews_signals |
@@ -61,55 +60,6 @@ def subscribe_contributor(resource, contributor, auth=None, *args, **kwargs): |
61 | 60 | ) |
62 | 61 |
|
63 | 62 |
|
64 | | -# @reviews_signals.reviews_email_submit_moderators_notifications.connect |
65 | | -def reviews_submit_notification_moderators(self, timestamp, context, resource): |
66 | | - """ |
67 | | - Handle email notifications to notify moderators of new submissions or resubmission. |
68 | | - """ |
69 | | - |
70 | | - # imports moved here to avoid AppRegistryNotReady error |
71 | | - from osf.models import NotificationType |
72 | | - from website.settings import DOMAIN |
73 | | - |
74 | | - provider = resource.provider |
75 | | - context['domain'] = DOMAIN |
76 | | - context['requester_contributor_names'] = ''.join(resource.contributors.values_list('fullname', flat=True)) |
77 | | - context['localized_timestamp'] = str(timezone.now()), |
78 | | - |
79 | | - # Set submission url |
80 | | - if provider.type == 'osf.preprintprovider': |
81 | | - context['reviews_submission_url'] = ( |
82 | | - f'{DOMAIN}reviews/preprints/{provider._id}/{resource._id}' |
83 | | - ) |
84 | | - elif provider.type == 'osf.registrationprovider': |
85 | | - context['reviews_submission_url'] = f'{DOMAIN}{resource._id}?mode=moderator' |
86 | | - else: |
87 | | - raise NotImplementedError(f'unsupported provider type {provider.type}') |
88 | | - |
89 | | - # Set message |
90 | | - revision_id = context.get('revision_id') |
91 | | - if revision_id: |
92 | | - context['message'] = f'submitted updates to "{resource.title}".' |
93 | | - context['reviews_submission_url'] += f'&revisionId={revision_id}' |
94 | | - else: |
95 | | - if context.get('resubmission'): |
96 | | - context['message'] = f'resubmitted "{resource.title}".' |
97 | | - else: |
98 | | - context['message'] = f'submitted "{resource.title}".' |
99 | | - |
100 | | - for recipient in resource.provider.get_group('moderator').user_set.all(): |
101 | | - context['user_fullname'] = recipient.fullname |
102 | | - context['recipient_fullname'] = recipient.fullname |
103 | | - context['requester_fullname'] = recipient.fullname |
104 | | - context['is_request_email'] = False |
105 | | - |
106 | | - NotificationType.Type.PROVIDER_NEW_PENDING_SUBMISSIONS.instance.emit( |
107 | | - user=recipient, |
108 | | - subscribed_object=provider, |
109 | | - event_context=context, |
110 | | - is_digest=True, |
111 | | - ) |
112 | | - |
113 | 63 | # Handle email notifications to notify moderators of new submissions. |
114 | 64 | @reviews_signals.reviews_withdraw_requests_notification_moderators.connect |
115 | 65 | def reviews_withdraw_requests_notification_moderators(self, timestamp, context, user, resource): |
|
0 commit comments