Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion addons/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@ def create_waterbutler_log(payload, **kwargs):
user=user,
subscribed_object=node,
event_context={
'user_fullname': user.fullname,
'action': payload['action'],
'source_node': source_node._id,
'source_node_title': source_node.title,
Expand Down
4 changes: 0 additions & 4 deletions addons/boa/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,11 @@ async def submit_to_boa_async(host, username, password, user_guid, project_guid,
user=user,
event_context={
'user_fullname': user.fullname,
'query_file_name': query_file_name,
'query_file_full_path': file_full_path,
'output_file_name': output_file_name,
'job_id': boa_job.id,
'project_url': project_url,
'boa_job_list_url': boa_settings.BOA_JOB_LIST_URL,
'boa_support_email': boa_settings.BOA_SUPPORT_EMAIL,
'osf_support_email': osf_settings.OSF_SUPPORT_EMAIL,
}
)
return BoaErrorCode.NO_ERROR
Expand All @@ -214,7 +211,6 @@ def handle_boa_error(message, code, username, fullname, project_url, query_file_
event_context={
'user_fullname': fullname,
'code': code,
'query_file_name': query_file_name,
'file_size': file_size,
'message': message,
'max_file_size': boa_settings.MAX_SUBMISSION_SIZE,
Expand Down
1 change: 0 additions & 1 deletion admin/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ def post(self, request, *args, **kwargs):
event_context={
'user_fullname': user.fullname,
'contact_email': OSF_SUPPORT_EMAIL,
'can_change_preferences': False,
}
)
else:
Expand Down
5 changes: 0 additions & 5 deletions api/institutions/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ def authenticate(self, request):
user=user,
event_context={
'domain': DOMAIN,
'osf_support_email': OSF_SUPPORT_EMAIL,
'user_fullname': user.fullname,
'storage_flag_is_active': flag_is_active(request, features.STORAGE_I18N),
},
Expand All @@ -368,9 +367,7 @@ def authenticate(self, request):
event_context={
'user_fullname': user.fullname,
'email_to_add': email_to_add,
'domain': DOMAIN,
'osf_support_email': OSF_SUPPORT_EMAIL,
'storage_flag_is_active': flag_is_active(request, features.STORAGE_I18N),
},
save=False,
)
Expand All @@ -390,10 +387,8 @@ def authenticate(self, request):
'user_fullname': user.fullname,
'user_username': user.username,
'user__id': user._id,
'duplicate_user_fullname': duplicate_user.fullname,
'duplicate_user_username': duplicate_user.username,
'duplicate_user__id': duplicate_user._id,
'domain': DOMAIN,
'osf_support_email': OSF_SUPPORT_EMAIL,
},
)
Expand Down
4 changes: 0 additions & 4 deletions api/nodes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,9 +1069,7 @@ def perform_create(self, serializer):
user=user,
subscribed_object=node,
event_context={
'domain': settings.DOMAIN,
'node_title': node.title,
'can_change_preferences': False,
},
)
raise exc
Expand All @@ -1082,9 +1080,7 @@ def perform_create(self, serializer):
event_context={
'domain': settings.DOMAIN,
'node_title': node.title,
'fork_title': fork.title,
'fork__id': fork._id,
'can_change_preferences': False,
},
)

Expand Down
2 changes: 0 additions & 2 deletions api/providers/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,13 +653,11 @@ def bulk_upload_finish_job(upload, row_count, success_count, draft_errors, appro
user=initiator,
event_context={
'user_fullname': initiator.fullname,
'initiator_fullname': initiator.fullname,
'auto_approval': auto_approval,
'count': row_count,
'total': row_count,
'pending_submissions_url': f'{get_registration_provider_submissions_url(provider)}?status=pending',
'draft_errors': draft_errors,
'approval_errors': approval_errors,
'successes': success_count,
'failures': len(draft_errors),
'osf_support_email': settings.OSF_SUPPORT_EMAIL,
Expand Down
3 changes: 1 addition & 2 deletions api/requests/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,9 @@ def make_node_institutional_access_request(self, node, validated_data) -> NodeRe
'sender_absolute_url': sender.absolute_url,
'node_absolute_url': node_request.target.absolute_url,
'node_title': node_request.target.title,
'recipient_fullname': recipient.username if recipient else None,
'recipient_username': recipient.username if recipient else None,
'comment': comment,
'domain': settings.DOMAIN,
'institution_name': institution.name if institution else None,
},
email_context={
'bcc_addr': [sender.username] if validated_data['bcc_sender'] else None,
Expand Down
1 change: 0 additions & 1 deletion api/users/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,6 @@ def update(self, instance, validated_data):
event_context={
'user_fullname': user.fullname,
'new_address': user.username,
'can_change_preferences': False,
'osf_contact_email': settings.OSF_CONTACT_EMAIL,
},
)
Expand Down
1 change: 0 additions & 1 deletion api/users/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def send_password_reset_email(user, email, verification_type='password', institu
destination_address=email,
event_context={
'reset_link': reset_link,
'can_change_preferences': False,
**mail_kwargs,
},
)
Expand Down
4 changes: 0 additions & 4 deletions api/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,6 @@ def create(self, request, *args, **kwargs):
'user_username': user.username,
'user_absolute_url': user.absolute_url,
'user__id': user._id,
'can_change_preferences': False,
},
)
user.email_last_sent = timezone.now()
Expand Down Expand Up @@ -863,7 +862,6 @@ def get(self, request, *args, **kwargs):
user=user_obj,
message_frequency='instantly',
event_context={
'can_change_preferences': False,
'reset_link': reset_link,
},
)
Expand Down Expand Up @@ -1171,7 +1169,6 @@ def _process_external_identity(self, user, external_identity, service_url):
message_frequency='instantly',
event_context={
'user_fullname': user.fullname,
'can_change_preferences': False,
'external_id_provider': provider,
},
)
Expand Down Expand Up @@ -1492,7 +1489,6 @@ def post(self, request, *args, **kwargs):
user=user,
message_frequency='instantly',
event_context={
'can_change_preferences': False,
'external_id_provider': provider.name,
},
)
Expand Down
4 changes: 0 additions & 4 deletions framework/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,6 @@ def _forgot_password_post(notificaton_type, reset_route, institutional=False):
user=user_obj,
event_context={
'reset_link': reset_link,
'can_change_preferences': False,
'osf_contact_email': settings.OSF_CONTACT_EMAIL,
},
)

Expand Down Expand Up @@ -664,7 +662,6 @@ def external_login_confirm_email_get(auth, uid, token):
event_context={
'user_fullname': user.fullname,
'external_id_provider': provider,
'can_change_preferences': False,
'osf_contact_email': settings.OSF_CONTACT_EMAIL,
},
)
Expand Down Expand Up @@ -869,7 +866,6 @@ def send_confirm_email(user, email, renew=False, external_id_provider=None, exte
event_context={
'user_fullname': user.fullname,
'confirmation_url': f'{confirmation_url}{logout_query}',
'can_change_preferences': False,
'external_id_provider': external_id_provider,
'osf_contact_email': settings.OSF_CONTACT_EMAIL,
'osf_support_email': settings.OSF_SUPPORT_EMAIL,
Expand Down
3 changes: 0 additions & 3 deletions notifications/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ def send_user_email_task(self, user_id, notification_ids, **kwargs):

event_context = {
'notifications': rendered_notifications,
'user_fullname': user.fullname,
'can_change_preferences': False
}

NotificationType.Type.USER_DIGEST.instance.emit(
Expand Down Expand Up @@ -252,7 +250,6 @@ def send_moderator_email_task(self, user_id, notification_ids, provider_content_
event_context = {
'notifications': rendered_notifications,
'user_fullname': user.fullname,
'can_change_preferences': False,
'notification_settings_url': notification_settings_url,
'reviews_withdrawal_url': withdrawals_url,
'reviews_submissions_url': submissions_url,
Expand Down
1 change: 0 additions & 1 deletion osf/management/commands/check_crossref_dois.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def report_stuck_dois(dry_run=True):
NotificationType.Type.USER_CROSSREF_DOI_PENDING.instance.emit(
destination_address=settings.OSF_SUPPORT_EMAIL,
event_context={
'pending_doi_count': preprints_with_pending_dois.count(),
'time_since_published': time_since_published.days,
'guids': guids,
}
Expand Down
2 changes: 0 additions & 2 deletions osf/management/commands/deactivate_requested_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def deactivate_requested_accounts(dry_run=True):
'user__id': user._id,
'user_absolute_url': user.absolute_url,
'user_username': user.username,
'can_change_preferences': False,
}
)
else:
Expand All @@ -40,7 +39,6 @@ def deactivate_requested_accounts(dry_run=True):
event_context={
'user_fullname': user.fullname,
'contact_email': OSF_SUPPORT_EMAIL,
'can_change_preferences': False,
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def main(json_file, dry=False):
event_context={
'public_nodes': public_nodes,
'private_nodes': private_nodes,
'can_change_preferences': False,
}
)
except Exception:
Expand Down
30 changes: 0 additions & 30 deletions osf/models/collection_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,12 @@ def _notify_moderators_pending(self, event_data):
user=user,
subscribed_object=self.collection.provider,
event_context={
'provider_id': self.collection.provider.id,
'submitter_fullname': self.creator.fullname,
'requester_fullname': event_data.kwargs.get('user').fullname,
'requester_contributor_names': ''.join(self.guid.referent.contributors.values_list('fullname', flat=True)),
'localized_timestamp': str(timezone.now()),
'message': f'submitted "{self.guid.referent.title}".',
'reviews_submission_url': f'{DOMAIN}reviews/registries/{self.guid.referent._id}/{self.guid.referent._id}',
'is_request_email': False,
'is_initiator': self.creator == user,
'profile_image_url': user.profile_image_url(),
'logo': self.collection.provider._id if
self.collection.provider and not self.collection.provider.is_default else settings.OSF_PREPRINTS_LOGO,
Expand Down Expand Up @@ -309,21 +306,14 @@ def _notify_removed(self, event_data):
**event_context_base,
'requester_contributor_names': ''.join(
self.guid.referent.contributors.values_list('fullname', flat=True)),

'is_admin': node.has_permission(contributor, ADMIN),
'rejection_justification': event_data.kwargs.get('comment'),
'collections_title': self.collection.title,
'collection_provider_name': self.collection.provider.name,
'collection_provider__id': self.collection.provider._id,
'remover_absolute_url': user.get_absolute_url() if user is not None else None,
'node_absolute_url': node.absolute_url,
'collection_provider': self.collection.provider.name,
'collections_link': DOMAIN + 'collections/' + self.collection.provider._id,
'user_fullname': contributor.fullname,
'is_request_email': False,
'message': '',
'localized_timestamp': str(timezone.now()),
'reviews_submission_url': f'{DOMAIN}reviews/registries/{self.guid.referent._id}/{self.guid.referent._id}',
},
)
elif is_admin and self.collection.provider:
Expand All @@ -332,21 +322,12 @@ def _notify_removed(self, event_data):
user=contributor,
event_context={
**event_context_base,
'requester_contributor_names': ''.join(
self.guid.referent.contributors.values_list('fullname', flat=True)),
'localized_timestamp': str(timezone.now()),
'user_fullname': contributor.fullname,
'collections_title': self.collection.title,
'collection_provider_name': self.collection.provider.name,
'collection_provider__id': self.collection.provider._id,
'collection_provider': self.collection.provider.name,
'collections_link': DOMAIN + 'collections/' + self.collection.provider._id,
'node_absolute_url': node.get_absolute_url(),
'is_request_email': False,
'message': '',
'is_admin': node.has_permission(contributor, ADMIN),
'reviews_submission_url': f'{DOMAIN}reviews/registries/{self.guid.referent._id}/{self.guid.referent._id}',

},
)

Expand Down Expand Up @@ -392,29 +373,18 @@ def _notify_cancel(self, event_data):
user=contributor,
subscribed_object=self.collection,
event_context={
'requester_contributor_names': ''.join(
node.contributors.values_list('fullname', flat=True)),
'profile_image_url': user.profile_image_url(),
'user_fullname': contributor.fullname,
'requester_fullname': self.creator.fullname,
'is_admin': node.has_permission(contributor, ADMIN),
'node_title': node.title,
'node_absolute_url': node.get_absolute_url(),
'remover_fullname': user.fullname if user else '',
'remover_absolute_url': user.get_absolute_url() if user else '',
'localized_timestamp': str(timezone.now()),
'collections_link': collections_link,
'collection_title': self.collection.title,
'collection_provider_name': collection_provider_name,
'node_absolute_url"': node.get_absolute_url(),
'collection_provider': collection_provider_name,
'domain': settings.DOMAIN,
'is_request_email': False,
'message': '',
'osf_contact_email': settings.OSF_CONTACT_EMAIL,
'reviews_submission_url': f'{DOMAIN}reviews/registries/{self.guid.referent._id}/{self.guid.referent._id}',
'logo': self.collection.provider._id if
self.collection.provider and not self.collection.provider.is_default else settings.OSF_PREPRINTS_LOGO,
},
)

Expand Down
1 change: 0 additions & 1 deletion osf/models/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -2327,7 +2327,6 @@ def suspend_spam_user(self, user):
event_context={
'user_fullname': user.fullname,
'osf_support_email': settings.OSF_SUPPORT_EMAIL,
'can_change_preferences': False
}
)
user.save()
Expand Down
6 changes: 0 additions & 6 deletions osf/models/preprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,24 +1075,18 @@ def _send_preprint_confirmation(self, auth):
subscribed_object=self.provider,
user=recipient,
event_context={
'domain': settings.DOMAIN,
'user_fullname': recipient.fullname,
'referrer_fullname': recipient.fullname,
'reviewable_title': self.title,
'no_future_emails': self.provider.allow_submissions,
'reviewable_absolute_url': self.absolute_url,
'reviewable_provider_name': self.provider.name,
'reviewable_provider__id': self.provider._id,
'workflow': self.provider.reviews_workflow,
'provider_url': f'{self.provider.domain or settings.DOMAIN}preprints/'
f'{(self.provider._id if not self.provider.domain else '').strip('/')}',
'provider_contact_email': self.provider.email_contact or settings.OSF_CONTACT_EMAIL,
'provider_support_email': self.provider.email_support or settings.OSF_SUPPORT_EMAIL,
'is_creator': True,
'provider_name': 'OSF Preprints' if self.provider.name == 'Open Science Framework' else self.provider.name,
'logo': settings.OSF_PREPRINTS_LOGO if self.provider._id == 'osf' else self.provider._id,
'document_type': self.provider.preprint_word,
'notify_comment': not self.provider.reviews_comments_private
},
)

Expand Down
1 change: 0 additions & 1 deletion osf/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,6 @@ def set_password(self, raw_password, notify=True):
event_context={
'domain': website_settings.DOMAIN,
'user_fullname': self.fullname,
'can_change_preferences': False,
'osf_contact_email': website_settings.OSF_CONTACT_EMAIL
}
)
Expand Down
7 changes: 0 additions & 7 deletions osf/utils/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,14 @@ def notify_edit_comment(resource, user, action, states, *args, **kwargs):
def notify_reject_withdraw_request(resource, action, *args, **kwargs):
context = get_email_template_context(resource)
context['requester_fullname'] = action.creator.fullname
context['referrer_fullname'] = action.creator.fullname
context['force_withdrawal'] = False
context['notify_comment'] = not resource.provider.reviews_comments_private
context['reviewable_withdrawal_justification'] = resource.withdrawal_justification

for contributor in resource.contributors.all():
context['user_fullname'] = contributor.fullname
context['contributor_fullname'] = contributor.fullname
context['is_requester'] = action.creator == contributor
context['comment'] = action.comment
NotificationType.Type.NODE_WITHDRAWAl_REQUEST_REJECTED.instance.emit(
user=contributor,
event_context={
'is_requester': contributor == action.creator,
'ever_public': getattr(resource, 'ever_public', resource.is_public),
**context
},
)
Expand Down
1 change: 0 additions & 1 deletion scripts/stuck_registration_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def main():
'broken_registrations_count': len(broken_registrations),
'attachment_name': filename,
'attachement_content': output.getvalue(),
'can_change_preferences': False
}
)

Expand Down
Loading
Loading