mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
Sharing stories from Saved Stories now works if the story has been deleted. Thanks to @ojiikun for the find.
This commit is contained in:
parent
72655a5116
commit
01c7a1f638
2 changed files with 9 additions and 1 deletions
|
@ -872,6 +872,7 @@ class Feed(models.Model):
|
|||
|
||||
def trim_feed(self, verbose=False):
|
||||
from apps.reader.models import MUserStory
|
||||
SUBSCRIBER_EXPIRE = datetime.datetime.now() - datetime.timedelta(days=settings.SUBSCRIBER_EXPIRE)
|
||||
trim_cutoff = 500
|
||||
if self.active_subscribers <= 1 and self.premium_subscribers < 1:
|
||||
trim_cutoff = 100
|
||||
|
@ -898,7 +899,10 @@ class Feed(models.Model):
|
|||
extra_stories.delete()
|
||||
if verbose:
|
||||
print "Deleted %s stories, %s left." % (extra_stories_count, MStory.objects(story_feed_id=self.pk).count())
|
||||
userstories = MUserStory.objects(feed_id=self.pk, story_date__lte=story_trim_date)
|
||||
|
||||
# Can't use the story_trim_date because some users may have shared stories from
|
||||
# this feed, but the trim date isn't past the two weeks of unreads.
|
||||
userstories = MUserStory.objects(feed_id=self.pk, story_date__lte=SUBSCRIBER_EXPIRE)
|
||||
if userstories.count():
|
||||
if verbose:
|
||||
print "Found %s user stories. Deleting..." % userstories.count()
|
||||
|
|
|
@ -305,6 +305,10 @@ def mark_story_as_shared(request):
|
|||
original_story_found = False
|
||||
story = MSharedStory.objects.filter(story_feed_id=feed_id,
|
||||
story_guid=story_id).limit(1).first()
|
||||
if not story:
|
||||
story = MStarredStory.objects.filter(story_feed_id=feed_id,
|
||||
story_guid=story_id).limit(1).first()
|
||||
|
||||
if not story:
|
||||
return json.json_response(request, {
|
||||
'code': -1,
|
||||
|
|
Loading…
Add table
Reference in a new issue