From e5c887c2fc62cfdeca74be7100b2468edc6a9b7f Mon Sep 17 00:00:00 2001 From: Nick Sergeant Date: Sun, 25 Oct 2015 23:19:22 -0400 Subject: [PATCH] Notifications around teams and users. --- accounts/views.py | 10 ++++++++++ media/js/src/modules/snipt.js | 16 ---------------- teams/views.py | 20 ++++++++++++++++++++ templates/base.html | 8 -------- views.py | 11 +++++++++++ 5 files changed, 41 insertions(+), 24 deletions(-) diff --git a/accounts/views.py b/accounts/views.py index d322c12..3446670 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -4,6 +4,7 @@ import stripe from annoying.decorators import ajax_request, render_to from django.conf import settings from django.contrib.auth.decorators import login_required +from django.core.mail import send_mail from snipts.models import Snipt @@ -30,6 +31,15 @@ def cancel_subscription(request): profile.stripe_id = None profile.save() + send_mail('[Snipt] User cancelled Pro: {}'.format(request.user.username), + """ + User: https://snipt.net/{} + Email: {} + """.format(request.user.username, request.user.email), + 'support@snipt.net', + ['nick@snipt.net'], + fail_silently=False) + return {'deleted': True} diff --git a/media/js/src/modules/snipt.js b/media/js/src/modules/snipt.js index 3e40820..7b85b44 100644 --- a/media/js/src/modules/snipt.js +++ b/media/js/src/modules/snipt.js @@ -872,22 +872,6 @@ $document.bind('keydown', 'esc', function() { that.escapeUI(); }); - $document.bind('keydown', 'g', function() { - if (!window.ui_halted) { - if (window.$selected) { - window.$selected.trigger('deselect'); - } - window.scrollTo(0, 0); - } - }); - $document.bind('keydown', 'Shift+g', function() { - if (!window.ui_halted) { - if (window.$selected) { - window.$selected.trigger('deselect'); - } - window.scrollTo(0, document.body.scrollHeight); - } - }); $document.bind('keydown', 'n', function() { if (!window.ui_halted) { var $anc = $('li.next a'); diff --git a/teams/views.py b/teams/views.py index 41bad1a..73393eb 100644 --- a/teams/views.py +++ b/teams/views.py @@ -6,6 +6,7 @@ from annoying.decorators import render_to from django.conf import settings from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User +from django.core.mail import send_mail from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequest from django.shortcuts import get_object_or_404 from teams.models import Team @@ -55,6 +56,16 @@ def for_teams_complete(request): team.user = user team.save() + send_mail('[Snipt] New team signup: {}'.format(team.name), + """ + Team: https://snipt.net/{} + Email: {} + Plan: {} + """.format(team.slug, team.email, team.plan), + 'support@snipt.net', + ['nick@snipt.net'], + fail_silently=False) + return { 'team': team } @@ -155,4 +166,13 @@ def cancel_team_subscription(request, username): team.plan = None team.save() + send_mail('[Snipt] Team cancelled plan: {}'.format(team.name), + """ + Team: https://snipt.net/{} + Email: {} + """.format(team.slug, team.email), + 'support@snipt.net', + ['nick@snipt.net'], + fail_silently=False) + return HttpResponseRedirect('/' + team.slug + '/?team-cancelled=true') diff --git a/templates/base.html b/templates/base.html index d1d4a8c..cb55026 100644 --- a/templates/base.html +++ b/templates/base.html @@ -364,14 +364,6 @@ p Previous page - - g - Scroll to top of page - - - G - Scroll to bottom of page - diff --git a/views.py b/views.py index 9552ece..70b93ea 100644 --- a/views.py +++ b/views.py @@ -9,6 +9,7 @@ from blogs.views import blog_list from django.conf import settings from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User +from django.core.mail import send_mail from django.db.models import Count from django.http import HttpResponseRedirect, HttpResponseBadRequest from django.shortcuts import render_to_response @@ -117,6 +118,16 @@ def pro_complete(request): profile.stripe_id = customer.id profile.save() + send_mail('[Snipt] New Pro signup: {}'.format(request.user.username), + """ + User: https://snipt.net/{} + Email: {} + Plan: {} + """.format(request.user.username, request.user.email, plan), + 'support@snipt.net', + ['nick@snipt.net'], + fail_silently=False) + return {} else: