mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-19 04:46:09 +00:00
Merge branch 'master' into social
* master: Fixing two major bugs: auto filling stories now works far better nad doesn't lock you in. Also fixing the infernal unicode json parsing bug that's been effecting a bunch of sites.
This commit is contained in:
commit
9837c5a9ee
5 changed files with 29 additions and 7 deletions
|
@ -354,7 +354,7 @@ def load_single_feed(request, feed_id):
|
|||
start = time.time()
|
||||
user = get_user(request)
|
||||
offset = int(request.REQUEST.get('offset', 0))
|
||||
limit = int(request.REQUEST.get('limit', 12))
|
||||
limit = int(request.REQUEST.get('limit', 6))
|
||||
page = int(request.REQUEST.get('page', 1))
|
||||
dupe_feed_id = None
|
||||
userstories_db = None
|
||||
|
|
|
@ -812,12 +812,13 @@ class Feed(models.Model):
|
|||
|
||||
@classmethod
|
||||
def format_story(cls, story_db, feed_id=None, text=False):
|
||||
story_content = story_db.story_content_z and zlib.decompress(story_db.story_content_z) or ''
|
||||
story = {}
|
||||
story['story_tags'] = story_db.story_tags or []
|
||||
story['story_date'] = story_db.story_date
|
||||
story['story_authors'] = story_db.story_author_name
|
||||
story['story_title'] = story_db.story_title
|
||||
story['story_content'] = story_db.story_content_z and zlib.decompress(story_db.story_content_z) or ''
|
||||
story['story_content'] = story_content
|
||||
story['story_permalink'] = urllib.unquote(urllib.unquote(story_db.story_permalink))
|
||||
story['story_feed_id'] = feed_id or story_db.story_feed_id
|
||||
story['id'] = story_db.story_guid or story_db.story_date
|
||||
|
|
|
@ -92,7 +92,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
|
|||
}
|
||||
},
|
||||
error: function(e, textStatus, errorThrown) {
|
||||
NEWSBLUR.log(['AJAX Error', textStatus, errorThrown]);
|
||||
NEWSBLUR.log(['AJAX Error', e, textStatus, errorThrown]);
|
||||
if (errorThrown == 'abort') {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1823,6 +1823,21 @@
|
|||
this.show_tryfeed_add_button();
|
||||
}
|
||||
this.make_content_pane_feed_counter(feed_id);
|
||||
this.scroll_back_to_original_position_before_fillout();
|
||||
},
|
||||
|
||||
scroll_back_to_original_position_before_fillout: function() {
|
||||
var $story_titles = this.$s.$story_titles;
|
||||
if (this.flags.post_load_page_scroll_position == $story_titles.scrollTop()) {
|
||||
// NEWSBLUR.log(['Snap back pre-autofill', this.flags.post_load_page_scroll_position, this.flags.pre_load_page_scroll_position]);
|
||||
$story_titles.scrollTo(this.flags.pre_load_page_scroll_position, {
|
||||
duration: 0,
|
||||
axis: 'y',
|
||||
easing: 'easeInOutQuint',
|
||||
offset: 0,
|
||||
queue: false
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setup_mousemove_on_views: function() {
|
||||
|
@ -1965,6 +1980,7 @@
|
|||
this.prefetch_story_locations_in_feed_view();
|
||||
this.scroll_story_titles_to_show_selected_story_title();
|
||||
this.fill_out_story_titles();
|
||||
this.scroll_back_to_original_position_before_fillout();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2045,6 +2061,7 @@
|
|||
this.fill_out_story_titles();
|
||||
this.prefetch_story_locations_in_feed_view();
|
||||
this.hide_stories_progress_bar();
|
||||
this.scroll_back_to_original_position_before_fillout();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -3263,7 +3280,7 @@
|
|||
var page = $story_titles.data('page');
|
||||
|
||||
if (!this.flags['opening_feed']) {
|
||||
|
||||
this.flags.pre_load_page_scroll_position = $('#story_titles').scrollTop();
|
||||
if (!hide_loading) this.show_feedbar_loading();
|
||||
$story_titles.data('page', page+1);
|
||||
if (this.active_feed == 'starred') {
|
||||
|
@ -3322,6 +3339,7 @@
|
|||
offset: 0,
|
||||
queue: false
|
||||
});
|
||||
this.flags.post_load_page_scroll_position = $('#story_titles').scrollTop();
|
||||
},
|
||||
|
||||
show_feed_title_in_stories: function(feed_id) {
|
||||
|
|
|
@ -2,7 +2,7 @@ from django.core.serializers.json import DateTimeAwareJSONEncoder
|
|||
from django.db import models
|
||||
from django.utils.functional import Promise
|
||||
from django.utils.encoding import force_unicode
|
||||
# from django.utils import simplejson as json
|
||||
from django.utils import simplejson as json
|
||||
import cjson
|
||||
from decimal import Decimal
|
||||
from django.core import serializers
|
||||
|
@ -11,6 +11,7 @@ from django.http import HttpResponse, HttpResponseForbidden, Http404
|
|||
from django.core.mail import mail_admins
|
||||
from django.db.models.query import QuerySet
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
def decode(data):
|
||||
if not data:
|
||||
|
@ -61,6 +62,8 @@ def json_encode(data, *args, **kwargs):
|
|||
# see http://code.djangoproject.com/ticket/5868
|
||||
elif isinstance(data, Promise):
|
||||
ret = force_unicode(data)
|
||||
elif isinstance(data, datetime.datetime):
|
||||
ret = str(data)
|
||||
else:
|
||||
ret = data
|
||||
return ret
|
||||
|
@ -90,8 +93,8 @@ def json_encode(data, *args, **kwargs):
|
|||
return ret
|
||||
|
||||
ret = _any(data)
|
||||
# return json.dumps(ret)
|
||||
return cjson.encode(ret, encoding='utf-8', extension=lambda x: "\"%s\"" % str(x))
|
||||
return json.dumps(ret)
|
||||
# return cjson.encode(ret, encoding='utf-8', extension=lambda x: "\"%s\"" % str(x))
|
||||
|
||||
def json_view(func):
|
||||
def wrap(request, *a, **kw):
|
||||
|
|
Loading…
Add table
Reference in a new issue