def get(self, request, user): """ Retrieve Account Subscriptions ````````````````````````````````````` Return list of subscriptions for an account :auth: required """ # This returns a dict with `subscriber` and `subscriptions` # Returns `None` if no subscriptions for user sub = newsletter.get_subscriptions(user) if sub is None or not newsletter.is_enabled(): return self.respond([]) return self.respond([{ 'listId': x.get('list_id'), 'listDescription': x.get('list_description'), 'listName': x.get('list_name'), 'email': x.get('email'), 'subscribed': x.get('subscribed'), 'subscribedDate': x.get('subscribed_date'), 'unsubscribedDate': x.get('unsubscribed_date'), } for x in sub['subscriptions']])
def get(self, request, user): """ Retrieve Account Subscriptions ````````````````````````````````````` Return list of subscriptions for an account :auth: required """ # This returns a dict with `subscriber` and `subscriptions` # Returns `None` if no subscriptions for user sub = newsletter.get_subscriptions(user) if sub is None or not newsletter.is_enabled(): return self.respond([]) return self.respond([{ "listId": x.get("list_id"), "listDescription": x.get("list_description"), "listName": x.get("list_name"), "email": x.get("email"), "subscribed": x.get("subscribed"), "subscribedDate": x.get("subscribed_date"), "unsubscribedDate": x.get("unsubscribed_date"), } for x in sub["subscriptions"]])
def __init__(self, *args, **kwargs): super(RegistrationForm, self).__init__(*args, **kwargs) if not newsletter.is_enabled(): del self.fields['subscribe'] else: self.fields['subscribe'].help_text = mark_safe( "We'd love to keep you updated via email with product and feature announcements, promotions, educational materials, and events. Our updates focus on relevant information and never sell your data to marketing companies. See our <a href=\"%(privacy_link)s\">Privacy Policy</a> for more details." .format(privacy_link=settings.PRIVACY_URL, ))
def handle(self, request): return self.respond( 'sentry/account/security.html', { 'page': 'security', 'has_2fa': Authenticator.objects.user_has_2fa(request.user), 'AUTH_PROVIDERS': get_auth_providers(), 'has_newsletters': newsletter.is_enabled(), })
def handle(self, request): return self.respond( 'sentry/account/security.html', { 'page': 'security', 'has_2fa': Authenticator.objects.user_has_2fa(request.user), 'AUTH_PROVIDERS': get_auth_providers(), 'has_newsletters': newsletter.is_enabled(), } )
def __init__(self, *args, **kwargs): super(RegistrationForm, self).__init__(*args, **kwargs) if not newsletter.is_enabled(): del self.fields['subscribe'] else: # NOTE: the text here is duplicated within the ``NewsletterConsent`` component # in the UI self.fields['subscribe'].help_text = mark_safe("We'd love to keep you updated via email with product and feature announcements, promotions, educational materials, and events. Our updates focus on relevant information and never sell your data to marketing companies. See our <a href=\"%(privacy_link)s\">Privacy Policy</a> for more details.".format( privacy_link=settings.PRIVACY_URL, ))
def verify_newsletter_subscription(sender, **kwargs): from sentry import newsletter if not newsletter.is_enabled(): return if not sender.is_primary(): return newsletter.update_subscription( sender.user, verified=True, verified_date=timezone.now(), )
def prepare_login_context(self, request, *args, **kwargs): can_register = bool(has_user_registration() or request.session.get("can_register")) context = { "serverHostname": get_server_hostname(), "canRegister": can_register, "hasNewsletter": newsletter.is_enabled(), } if "session_expired" in request.COOKIES: context["warning"] = WARN_SESSION_EXPIRED context.update(additional_context.run_callbacks(request)) return context
def __init__(self, *args, **kwargs): super(PasswordlessRegistrationForm, self).__init__(*args, **kwargs) if not newsletter.is_enabled(): del self.fields['subscribe'] else: # NOTE: the text here is duplicated within the ``NewsletterConsent`` component # in the UI notice = ( "We'd love to keep you updated via email with product and feature " "announcements, promotions, educational materials, and events. " "Our updates focus on relevant information, and we'll never sell " "your data to third parties. See our " "<a href=\"{privacy_link}\">Privacy Policy</a> for more details." ) self.fields['subscribe'].help_text = mark_safe( notice.format(privacy_link=settings.PRIVACY_URL))
def prepare_login_context(self, request, *args, **kwargs): can_register = bool(auth.has_user_registration() or request.session.get('can_register')) context = { 'serverHostname': get_server_hostname(), 'canRegister': can_register, 'hasNewsletter': newsletter.is_enabled(), } if 'session_expired' in request.COOKIES: context['warning'] = WARN_SESSION_EXPIRED context.update(additional_context.run_callbacks(request)) return context