Newsletters should also send notifications.

This commit is contained in:
Samuel Clay 2021-05-13 10:44:02 -04:00
parent 13fd328cfd
commit 520438aaec
2 changed files with 7 additions and 1 deletions

View file

@ -10,6 +10,9 @@ from django.utils.html import linebreaks
from apps.rss_feeds.models import Feed, MStory, MFetchHistory from apps.rss_feeds.models import Feed, MStory, MFetchHistory
from apps.reader.models import UserSubscription, UserSubscriptionFolders from apps.reader.models import UserSubscription, UserSubscriptionFolders
from apps.profile.models import Profile, MSentEmail from apps.profile.models import Profile, MSentEmail
from apps.notifications.tasks import QueueNotifications
from apps.notifications.models import MUserFeedNotification
from utils import log as logging from utils import log as logging
from utils.story_functions import linkify from utils.story_functions import linkify
from utils.scrubber import Scrubber from utils.scrubber import Scrubber
@ -208,4 +211,6 @@ class EmailNewsletter:
except redis.ConnectionError: except redis.ConnectionError:
logging.debug(" ***> [%-30s] ~BMRedis is unavailable for real-time." % (feed.log_title[:30],)) logging.debug(" ***> [%-30s] ~BMRedis is unavailable for real-time." % (feed.log_title[:30],))
if MUserFeedNotification.feed_has_users(feed.pk) > 0:
QueueNotifications.delay(feed.pk, 1)

View file

@ -24,7 +24,8 @@ from apps.reader.models import UserSubscription
from apps.rss_feeds.models import Feed, MStory from apps.rss_feeds.models import Feed, MStory
from apps.rss_feeds.page_importer import PageImporter from apps.rss_feeds.page_importer import PageImporter
from apps.rss_feeds.icon_importer import IconImporter from apps.rss_feeds.icon_importer import IconImporter
from apps.notifications.tasks import QueueNotifications, MUserFeedNotification from apps.notifications.tasks import QueueNotifications
from apps.notifications.models import MUserFeedNotification
from apps.push.models import PushSubscription from apps.push.models import PushSubscription
from apps.statistics.models import MAnalyticsFetcher, MStatistics from apps.statistics.models import MAnalyticsFetcher, MStatistics
import feedparser import feedparser