mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 13:35:58 +00:00
Merge branch 'muserstory_remove' into circular
* muserstory_remove: Removing story blurblog permalink, making it called explicitly. Conflicts: apps/social/views.py
This commit is contained in:
commit
be33aba026
2 changed files with 6 additions and 6 deletions
|
@ -1094,17 +1094,17 @@ class Feed(models.Model):
|
|||
return stories
|
||||
|
||||
@classmethod
|
||||
def format_stories(cls, stories_db, feed_id=None):
|
||||
def format_stories(cls, stories_db, feed_id=None, include_permalinks=False):
|
||||
stories = []
|
||||
|
||||
for story_db in stories_db:
|
||||
story = cls.format_story(story_db, feed_id)
|
||||
story = cls.format_story(story_db, feed_id, include_permalinks=include_permalinks)
|
||||
stories.append(story)
|
||||
|
||||
return stories
|
||||
|
||||
@classmethod
|
||||
def format_story(cls, story_db, feed_id=None, text=False):
|
||||
def format_story(cls, story_db, feed_id=None, text=False, include_permalinks=False):
|
||||
if isinstance(story_db.story_content_z, unicode):
|
||||
story_db.story_content_z = story_db.story_content_z.decode('base64')
|
||||
|
||||
|
@ -1130,7 +1130,7 @@ class Feed(models.Model):
|
|||
story['starred_date'] = story_db.starred_date
|
||||
if hasattr(story_db, 'shared_date'):
|
||||
story['shared_date'] = story_db.shared_date
|
||||
if hasattr(story_db, 'blurblog_permalink'):
|
||||
if include_permalinks and hasattr(story_db, 'blurblog_permalink'):
|
||||
story['blurblog_permalink'] = story_db.blurblog_permalink()
|
||||
if text:
|
||||
from BeautifulSoup import BeautifulSoup
|
||||
|
|
|
@ -370,8 +370,8 @@ def load_social_page(request, user_id, username=None, **kwargs):
|
|||
params['story_feed_id'] = feed_id
|
||||
|
||||
mstories = MSharedStory.objects(**params).order_by('-shared_date')[offset:offset+limit+1]
|
||||
stories = Feed.format_stories(mstories)
|
||||
|
||||
stories = Feed.format_stories(mstories, include_permalinks=True)
|
||||
|
||||
if len(stories) > limit:
|
||||
has_next_page = True
|
||||
stories = stories[:-1]
|
||||
|
|
Loading…
Add table
Reference in a new issue