Adding missing feeds for users as part of cleanup.

This commit is contained in:
Samuel Clay 2017-02-06 19:30:59 -08:00
parent 7b8795af15
commit 068829f379
3 changed files with 14 additions and 1 deletions

View file

@ -2,7 +2,7 @@ import datetime
from celery.task import Task
from apps.profile.models import Profile, RNewUserQueue
from utils import log as logging
from apps.reader.models import UserSubscription
from apps.reader.models import UserSubscription, UserSubscriptionFolders
from apps.social.models import MSocialServices, MActivity, MInteraction
class EmailNewUser(Task):
@ -62,6 +62,7 @@ class CleanupUser(Task):
Profile.count_all_feed_subscribers_for_user(user_id)
MInteraction.trim(user_id)
MActivity.trim(user_id)
UserSubscriptionFolders.add_missing_feeds_for_user(user_id)
# UserSubscription.refresh_stale_feeds(user_id)
try:

View file

@ -1589,6 +1589,16 @@ class UserSubscriptionFolders(models.Model):
for i, f in enumerate(usf):
print "%s/%s: %s" % (i, total, f)
f.add_missing_feeds()
@classmethod
def add_missing_feeds_for_user(cls, user_id):
user = User.objects.get(pk=user_id)
try:
usf = UserSubscriptionFolders.objects.get(user=user)
except UserSubscriptionFolders.DoesNotExist:
return
usf.add_missing_feeds()
def add_missing_feeds(self):
all_feeds = self.flat()

View file

@ -26,5 +26,7 @@
<p><a href="https://turntouch.com/kickstarter">Turn Touch is on Kickstarter</a>. Back the project to get your very own. Or—and this is my sincere recommendation—get the complete set, save some money, and give one away to a friend.</p>
<p>I've been working on Turn Touch for years and I hope it shows.</p>
<p style="text-align: center;"><a href="https://turntouch.com/kickstarter"><img src="https://turntouch.com/static/images/kickstarter/email-kickstarter-button@2x.png" style="width: 400px;height: 60px;margin: 0 auto;"></a></p>
{% endblock %}