mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-05 16:49:45 +00:00
Fixing bug in send_story_email -- newlines in the subject line. Doh. Also adding story_Date to read_stories, in the hopes it could fix another bug for bad unread counts.
This commit is contained in:
parent
162254ae05
commit
68d956e80b
2 changed files with 10 additions and 5 deletions
|
@ -167,7 +167,9 @@ class UserSubscription(models.Model):
|
|||
continue
|
||||
now = datetime.datetime.utcnow()
|
||||
date = now if now > story.story_date else story.story_date # For handling future stories
|
||||
m = MUserStory(story=story, user_id=self.user.pk, feed_id=self.feed.pk, read_date=date, story_id=story_id)
|
||||
m = MUserStory(story=story, user_id=self.user.pk,
|
||||
feed_id=self.feed.pk, read_date=date,
|
||||
story_id=story_id, story_date=story.story_date)
|
||||
try:
|
||||
m.save()
|
||||
except OperationError, e:
|
||||
|
@ -180,6 +182,7 @@ class UserSubscription(models.Model):
|
|||
logging.user(request, "~BRRead now date: %s, original read: %s, story_date: %s." % (m.read_date, original_m.read_date, story.story_date))
|
||||
original_m.story_id = story_id
|
||||
original_m.read_date = date
|
||||
original_m.story_date = story.story_date
|
||||
original_m.save()
|
||||
except OperationError, e:
|
||||
logging.user(request, "~BRCan't even save: %s" % (original_m.story_id))
|
||||
|
@ -284,9 +287,10 @@ class UserSubscription(models.Model):
|
|||
|
||||
self.save()
|
||||
|
||||
# if (self.unread_count_positive == 0 and
|
||||
# self.unread_count_neutral == 0):
|
||||
# self.mark_feed_read()
|
||||
if (self.unread_count_positive == 0 and
|
||||
self.unread_count_neutral == 0 and
|
||||
self.unread_count_negative == 0):
|
||||
self.mark_feed_read()
|
||||
|
||||
cache.delete('usersub:%s' % self.user.id)
|
||||
|
||||
|
@ -308,7 +312,7 @@ class MUserStory(mongo.Document):
|
|||
feed_id = mongo.IntField()
|
||||
read_date = mongo.DateTimeField()
|
||||
story_id = mongo.StringField()
|
||||
# story_date = mongo.DateTimeField()
|
||||
story_date = mongo.DateTimeField()
|
||||
story = mongo.ReferenceField(MStory, unique_with=('user_id', 'feed_id'))
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -1094,6 +1094,7 @@ def send_story_email(request):
|
|||
text = render_to_string('mail/email_story_text.xhtml', locals())
|
||||
html = render_to_string('mail/email_story_html.xhtml', locals())
|
||||
subject = "%s is sharing a story with you: \"%s\"" % (from_name, story['story_title'])
|
||||
subject = subject.replace('\n', ' ')
|
||||
msg = EmailMultiAlternatives(subject, text,
|
||||
from_email='NewsBlur <%s>' % from_address,
|
||||
to=[to_address],
|
||||
|
|
Loading…
Add table
Reference in a new issue