mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-05 16:49:45 +00:00
Adding email for first share to tell users about their blurblog.
This commit is contained in:
parent
912c632e1d
commit
d209b2e905
25 changed files with 88 additions and 20 deletions
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
from apps.analyzer import views
|
from apps.analyzer import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
from apps.api import views
|
from apps.api import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import url, patterns
|
from django.conf.urls import url, patterns
|
||||||
from apps.categories import views
|
from apps.categories import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
from apps.feed_import import views
|
from apps.feed_import import views
|
||||||
|
|
||||||
urlpatterns = patterns('apps.feed_import.views',
|
urlpatterns = patterns('apps.feed_import.views',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
from apps.mobile import views
|
from apps.mobile import views
|
||||||
|
|
||||||
urlpatterns = patterns('apps.mobile.views',
|
urlpatterns = patterns('apps.mobile.views',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import url, patterns
|
from django.conf.urls import url, patterns
|
||||||
from apps.oauth import views
|
from apps.oauth import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -297,6 +297,36 @@ class Profile(models.Model):
|
||||||
|
|
||||||
logging.user(self.user, "~BB~FM~SBSending email for new user: %s" % self.user.email)
|
logging.user(self.user, "~BB~FM~SBSending email for new user: %s" % self.user.email)
|
||||||
|
|
||||||
|
def send_first_share_to_blurblog_email(self, force=False):
|
||||||
|
from apps.social.models import MSocialProfile, MSharedStory
|
||||||
|
|
||||||
|
if not self.user.email:
|
||||||
|
return
|
||||||
|
|
||||||
|
sent_email, created = MSentEmail.objects.get_or_create(receiver_user_id=self.user.pk,
|
||||||
|
email_type='first_share')
|
||||||
|
|
||||||
|
if not created and not force:
|
||||||
|
return
|
||||||
|
|
||||||
|
social_profile = MSocialProfile.objects.get(user_id=self.user.pk)
|
||||||
|
params = {
|
||||||
|
'shared_stories': MSharedStory.objects.filter(user_id=self.user.pk).count(),
|
||||||
|
'blurblog_url': social_profile.blurblog_url,
|
||||||
|
'blurblog_rss': social_profile.blurblog_rss
|
||||||
|
}
|
||||||
|
user = self.user
|
||||||
|
text = render_to_string('mail/email_first_share_to_blurblog.txt', params)
|
||||||
|
html = render_to_string('mail/email_first_share_to_blurblog.xhtml', params)
|
||||||
|
subject = "Your shared stories on NewsBlur are available on your Blurblog"
|
||||||
|
msg = EmailMultiAlternatives(subject, text,
|
||||||
|
from_email='NewsBlur <%s>' % settings.HELLO_EMAIL,
|
||||||
|
to=['%s <%s>' % (user, user.email)])
|
||||||
|
msg.attach_alternative(html, "text/html")
|
||||||
|
msg.send(fail_silently=True)
|
||||||
|
|
||||||
|
logging.user(self.user, "~BB~FM~SBSending first share to blurblog email to: %s" % self.user.email)
|
||||||
|
|
||||||
def send_new_premium_email(self, force=False):
|
def send_new_premium_email(self, force=False):
|
||||||
subs = UserSubscription.objects.filter(user=self.user)
|
subs = UserSubscription.objects.filter(user=self.user)
|
||||||
message = """Woohoo!
|
message = """Woohoo!
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
from apps.profile import views
|
from apps.profile import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
from apps.push import views
|
from apps.push import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
from apps.reader import views
|
from apps.reader import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
from apps.recommendations import views
|
from apps.recommendations import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import url, patterns
|
from django.conf.urls import url, patterns
|
||||||
from apps.rss_feeds import views
|
from apps.rss_feeds import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -114,6 +114,13 @@ class MSocialProfile(mongo.Document):
|
||||||
self.username_slug,
|
self.username_slug,
|
||||||
Site.objects.get_current().domain.replace('www.', ''))
|
Site.objects.get_current().domain.replace('www.', ''))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def blurblog_rss(self):
|
||||||
|
return "%s%s" % (self.blurblog_url, reverse('shared-stories-rss-feed',
|
||||||
|
kwargs={'user_id': self.user_id,
|
||||||
|
'username': self.username_slug}))
|
||||||
|
|
||||||
|
|
||||||
def recommended_users(self):
|
def recommended_users(self):
|
||||||
r = redis.Redis(connection_pool=settings.REDIS_POOL)
|
r = redis.Redis(connection_pool=settings.REDIS_POOL)
|
||||||
following_key = "F:%s:F" % (self.user_id)
|
following_key = "F:%s:F" % (self.user_id)
|
||||||
|
|
|
@ -26,6 +26,12 @@ class EmailFollowRequest(Task):
|
||||||
user_profile = MSocialProfile.get_user(followee_user_id)
|
user_profile = MSocialProfile.get_user(followee_user_id)
|
||||||
user_profile.send_email_for_follow_request(follower_user_id)
|
user_profile.send_email_for_follow_request(follower_user_id)
|
||||||
|
|
||||||
|
class EmailFirstShare(Task):
|
||||||
|
|
||||||
|
def run(self, user_id):
|
||||||
|
user = User.objects.get(pk=user_id)
|
||||||
|
user.profile.send_first_share_to_blurblog_email()
|
||||||
|
|
||||||
class EmailCommentReplies(Task):
|
class EmailCommentReplies(Task):
|
||||||
|
|
||||||
def run(self, shared_story_id, reply_id):
|
def run(self, shared_story_id, reply_id):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import url, patterns
|
from django.conf.urls import url, patterns
|
||||||
from apps.social import views
|
from apps.social import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -17,7 +17,7 @@ from apps.rss_feeds.models import MStory, Feed, MStarredStory
|
||||||
from apps.social.models import MSharedStory, MSocialServices, MSocialProfile, MSocialSubscription, MCommentReply
|
from apps.social.models import MSharedStory, MSocialServices, MSocialProfile, MSocialSubscription, MCommentReply
|
||||||
from apps.social.models import MInteraction, MActivity, MFollowRequest
|
from apps.social.models import MInteraction, MActivity, MFollowRequest
|
||||||
from apps.social.tasks import PostToService, EmailCommentReplies, EmailStoryReshares
|
from apps.social.tasks import PostToService, EmailCommentReplies, EmailStoryReshares
|
||||||
from apps.social.tasks import UpdateRecalcForSubscription
|
from apps.social.tasks import UpdateRecalcForSubscription, EmailFirstShare
|
||||||
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag
|
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag
|
||||||
from apps.analyzer.models import apply_classifier_titles, apply_classifier_feeds, apply_classifier_authors, apply_classifier_tags
|
from apps.analyzer.models import apply_classifier_titles, apply_classifier_feeds, apply_classifier_authors, apply_classifier_tags
|
||||||
from apps.analyzer.models import get_classifiers_for_user, sort_classifiers_by_feed
|
from apps.analyzer.models import get_classifiers_for_user, sort_classifiers_by_feed
|
||||||
|
@ -553,6 +553,8 @@ def mark_story_as_shared(request):
|
||||||
EmailStoryReshares.apply_async(kwargs=dict(shared_story_id=shared_story.id),
|
EmailStoryReshares.apply_async(kwargs=dict(shared_story_id=shared_story.id),
|
||||||
countdown=settings.SECONDS_TO_DELAY_CELERY_EMAILS)
|
countdown=settings.SECONDS_TO_DELAY_CELERY_EMAILS)
|
||||||
|
|
||||||
|
EmailFirstShare.apply_async(kwargs=dict(user_id=request.user.pk))
|
||||||
|
|
||||||
if format == 'html':
|
if format == 'html':
|
||||||
stories = MSharedStory.attach_users_to_stories(stories, profiles)
|
stories = MSharedStory.attach_users_to_stories(stories, profiles)
|
||||||
return render_to_response('social/social_story.xhtml', {
|
return render_to_response('social/social_story.xhtml', {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
from apps.statistics import views
|
from apps.statistics import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
13
templates/mail/email_first_share_to_blurblog.txt
Normal file
13
templates/mail/email_first_share_to_blurblog.txt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{% extends "mail/email_base.txt" %}
|
||||||
|
|
||||||
|
{% block body %}Your shared story is now on your Blurblog
|
||||||
|
|
||||||
|
You can view your Blurblog here: {{ blurblog_url }}
|
||||||
|
|
||||||
|
Your Blurblog also has an RSS feed: {{ blurblog_rss }}
|
||||||
|
|
||||||
|
{% if shared_stories > 1 %}You've already shared {{ shared_stories }} stories, but you may not have known that your shared stories are on your Blurblog.{% else %}You just shared your first story on NewsBlur. All of your shared stories are available on your Blurblog.{% endif %}
|
||||||
|
|
||||||
|
This is a personal website made for you that you can customize. You can also share out links to your blurblog, where friends and followers can reply and re-share your stories.
|
||||||
|
|
||||||
|
Blurblogs were built so you would have a way to share stories with people who aren't on NewsBlur and don't want to load the entire reader just to read and comment on your shared stories.{% endblock body %}
|
10
templates/mail/email_first_share_to_blurblog.xhtml
Normal file
10
templates/mail/email_first_share_to_blurblog.xhtml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{% extends "mail/email_base.xhtml" %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<p style="font-size: 37px; color:#555555; margin-top: 18px;margin-bottom: 10px;padding-top:6px;">Your shared story is now on your Blurblog</p>
|
||||||
|
<p style="line-height: 20px;">You can view your Blurblog here: {{ blurblog_url }}</p>
|
||||||
|
<p style="line-height: 20px;">Your Blurblog also has an RSS feed: {{ blurblog_rss }}</p>
|
||||||
|
<p style="line-height: 20px;">{% if shared_stories > 1 %}You've already shared {{ shared_stories }} stories, but you may not have known that your shared stories are on your Blurblog.{% else %}You just shared your first story on NewsBlur. All of your shared stories are available on your Blurblog.{% endif %}</p>
|
||||||
|
<p style="line-height: 20px;">This is a personal website made for you that you can customize. You can also share out links to your blurblog, where friends and followers can reply and re-share your stories.</p>
|
||||||
|
<p style="line-height: 20px;">Blurblogs were built so you would have a way to share stories with people who aren't on NewsBlur and don't want to load the entire reader just to read and comment on your shared stories.</p>
|
||||||
|
{% endblock %}
|
2
urls.py
2
urls.py
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import include, url, patterns
|
from django.conf.urls import include, url, patterns
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from apps.reader import views as reader_views
|
from apps.reader import views as reader_views
|
||||||
from apps.static import views as static_views
|
from apps.static import views as static_views
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
|
|
||||||
urlpatterns = patterns('paypal.standard.ipn.views',
|
urlpatterns = patterns('paypal.standard.ipn.views',
|
||||||
(r'^ipn/$', 'ipn'),
|
(r'^ipn/$', 'ipn'),
|
||||||
|
|
2
vendor/paypal/standard/ipn/urls.py
vendored
2
vendor/paypal/standard/ipn/urls.py
vendored
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
|
|
||||||
urlpatterns = patterns('paypal.standard.ipn.views',
|
urlpatterns = patterns('paypal.standard.ipn.views',
|
||||||
url(r'^$', 'ipn', name="paypal-ipn"),
|
url(r'^$', 'ipn', name="paypal-ipn"),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
|
|
||||||
urlpatterns = patterns('paypal.standard.pdt.views',
|
urlpatterns = patterns('paypal.standard.pdt.views',
|
||||||
(r'^pdt/$', 'pdt'),
|
(r'^pdt/$', 'pdt'),
|
||||||
|
|
2
vendor/paypal/standard/pdt/urls.py
vendored
2
vendor/paypal/standard/pdt/urls.py
vendored
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
|
|
||||||
urlpatterns = patterns('paypal.standard.pdt.views',
|
urlpatterns = patterns('paypal.standard.pdt.views',
|
||||||
url(r'^$', 'pdt', name="paypal-pdt"),
|
url(r'^$', 'pdt', name="paypal-pdt"),
|
||||||
|
|
2
vendor/zebra/urls.py
vendored
2
vendor/zebra/urls.py
vendored
|
@ -1,4 +1,4 @@
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls import *
|
||||||
|
|
||||||
from zebra import views
|
from zebra import views
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue