mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +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
|
return stories
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def format_stories(cls, stories_db, feed_id=None):
|
def format_stories(cls, stories_db, feed_id=None, include_permalinks=False):
|
||||||
stories = []
|
stories = []
|
||||||
|
|
||||||
for story_db in stories_db:
|
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)
|
stories.append(story)
|
||||||
|
|
||||||
return stories
|
return stories
|
||||||
|
|
||||||
@classmethod
|
@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):
|
if isinstance(story_db.story_content_z, unicode):
|
||||||
story_db.story_content_z = story_db.story_content_z.decode('base64')
|
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
|
story['starred_date'] = story_db.starred_date
|
||||||
if hasattr(story_db, 'shared_date'):
|
if hasattr(story_db, 'shared_date'):
|
||||||
story['shared_date'] = 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()
|
story['blurblog_permalink'] = story_db.blurblog_permalink()
|
||||||
if text:
|
if text:
|
||||||
from BeautifulSoup import BeautifulSoup
|
from BeautifulSoup import BeautifulSoup
|
||||||
|
|
|
@ -370,7 +370,7 @@ def load_social_page(request, user_id, username=None, **kwargs):
|
||||||
params['story_feed_id'] = feed_id
|
params['story_feed_id'] = feed_id
|
||||||
|
|
||||||
mstories = MSharedStory.objects(**params).order_by('-shared_date')[offset:offset+limit+1]
|
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:
|
if len(stories) > limit:
|
||||||
has_next_page = True
|
has_next_page = True
|
||||||
|
|
Loading…
Add table
Reference in a new issue