mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
66a9afb06b
12 changed files with 37 additions and 12 deletions
|
@ -173,14 +173,18 @@ def check_share_on_site(request, token):
|
|||
except Profile.DoesNotExist:
|
||||
code = -1
|
||||
|
||||
logging.user(request.user, "~FBFinding feed (check_share_on_site): %s" % rss_url)
|
||||
feed = Feed.get_feed_from_url(rss_url, create=False, fetch=False)
|
||||
if not feed:
|
||||
logging.user(request.user, "~FBFinding feed (check_share_on_site): %s" % story_url)
|
||||
feed = Feed.get_feed_from_url(story_url, create=False, fetch=False)
|
||||
if not feed:
|
||||
parsed_url = urlparse.urlparse(story_url)
|
||||
base_url = "%s://%s%s" % (parsed_url.scheme, parsed_url.hostname, parsed_url.path)
|
||||
logging.user(request.user, "~FBFinding feed (check_share_on_site): %s" % base_url)
|
||||
feed = Feed.get_feed_from_url(base_url, create=False, fetch=False)
|
||||
if not feed:
|
||||
logging.user(request.user, "~FBFinding feed (check_share_on_site): %s" % (base_url + '/'))
|
||||
feed = Feed.get_feed_from_url(base_url+'/', create=False, fetch=False)
|
||||
|
||||
if feed and user:
|
||||
|
@ -271,8 +275,10 @@ def share_story(request, token=None):
|
|||
feed = Feed.get_by_id(feed_id)
|
||||
else:
|
||||
if rss_url:
|
||||
logging.user(request.user, "~FBFinding feed (share_story): %s" % rss_url)
|
||||
feed = Feed.get_feed_from_url(rss_url, create=True, fetch=True)
|
||||
if not feed:
|
||||
logging.user(request.user, "~FBFinding feed (share_story): %s" % story_url)
|
||||
feed = Feed.get_feed_from_url(story_url, create=True, fetch=True)
|
||||
if feed:
|
||||
feed_id = feed.pk
|
||||
|
|
|
@ -61,7 +61,7 @@ class EmailNewsletter:
|
|||
"story_date": datetime.datetime.fromtimestamp(int(params['timestamp'])),
|
||||
"story_title": params['subject'],
|
||||
"story_content": story_content,
|
||||
"story_author_name": escape(params['from']),
|
||||
"story_author_name": params['from'],
|
||||
"story_permalink": reverse('newsletter-story',
|
||||
kwargs={'story_hash': story_hash}),
|
||||
"story_guid": params['signature'],
|
||||
|
|
|
@ -631,6 +631,7 @@ def api_share_new_story(request):
|
|||
story_author = fields.get('story_author', "")
|
||||
comments = fields.get('comments', None)
|
||||
|
||||
logging.user(request.user, "~FBFinding feed (api_share_new_story): %s" % story_url)
|
||||
original_feed = Feed.get_feed_from_url(story_url, create=True, fetch=True)
|
||||
story_hash = MStory.guid_hash_unsaved(story_url)
|
||||
if not user.profile.is_premium and MSharedStory.feed_quota(user.pk, original_feed and original_feed.pk or 0, story_hash):
|
||||
|
@ -716,6 +717,7 @@ def api_save_new_story(request):
|
|||
user_tags = fields.get('user_tags', "")
|
||||
story = None
|
||||
|
||||
logging.user(request.user, "~FBFinding feed (api_save_new_story): %s" % story_url)
|
||||
original_feed = Feed.get_feed_from_url(story_url)
|
||||
if not story_content or not story_title:
|
||||
ti = TextImporter(feed=original_feed, story_url=story_url, request=request)
|
||||
|
|
|
@ -1860,6 +1860,7 @@ def delete_feed_by_url(request):
|
|||
if in_folder == ' ':
|
||||
in_folder = ""
|
||||
|
||||
logging.user(request.user, "~FBFinding feed (delete_feed_by_url): %s" % url)
|
||||
feed = Feed.get_feed_from_url(url, create=False)
|
||||
if feed:
|
||||
user_sub_folders = get_object_or_404(UserSubscriptionFolders, user=request.user)
|
||||
|
|
|
@ -1205,6 +1205,7 @@ class Feed(models.Model):
|
|||
existing_story.story_permalink = story_link
|
||||
existing_story.story_guid = story.get('guid')
|
||||
existing_story.story_tags = story_tags
|
||||
existing_story.original_text_z = None # Reset Text view cache
|
||||
# Do not allow publishers to change the story date once a story is published.
|
||||
# Leads to incorrect unread story counts.
|
||||
if replace_story_date:
|
||||
|
@ -1365,7 +1366,7 @@ class Feed(models.Model):
|
|||
read_stories_last_month = sum([int(rs) for rs in read_stories_per_week if rs])
|
||||
if read_stories_last_month == 0:
|
||||
original_cutoff = cutoff
|
||||
cutoff = min(cutoff, 25)
|
||||
cutoff = min(cutoff, 10)
|
||||
try:
|
||||
logging.debug(" ---> [%-30s] ~FBTrimming down to ~SB%s (instead of %s)~SN stories (~FM%s~FB)" % (self, cutoff, original_cutoff, self.last_story_date.strftime("%Y-%m-%d") if self.last_story_date else "No last story date"))
|
||||
except ValueError, e:
|
||||
|
|
|
@ -32,14 +32,19 @@ IGNORE_AUTOCOMPLETE = [
|
|||
"latitude",
|
||||
]
|
||||
|
||||
@ajax_login_required
|
||||
@json.json_view
|
||||
def search_feed(request):
|
||||
address = request.REQUEST.get('address')
|
||||
offset = int(request.REQUEST.get('offset', 0))
|
||||
if not address:
|
||||
return dict(code=-1, message="Please provide a URL/address.")
|
||||
|
||||
feed = Feed.get_feed_from_url(address, create=False, aggressive=True, offset=offset)
|
||||
|
||||
logging.user(request.user, "~FBFinding feed (search_feed): %s" % address)
|
||||
ip = request.META.get('HTTP_X_FORWARDED_FOR', None) or request.META['REMOTE_ADDR']
|
||||
logging.user(request.user, "~FBIP: %s" % ip)
|
||||
aggressive = request.user.is_authenticated()
|
||||
feed = Feed.get_feed_from_url(address, create=False, aggressive=aggressive, offset=offset)
|
||||
if feed:
|
||||
return feed.canonical()
|
||||
else:
|
||||
|
@ -244,7 +249,8 @@ def load_feed_settings(request, feed_id):
|
|||
stats['duplicate_addresses'] = feed.duplicate_addresses.all()
|
||||
|
||||
return stats
|
||||
|
||||
|
||||
@ratelimit(minutes=10, requests=10)
|
||||
@json.json_view
|
||||
def exception_retry(request):
|
||||
user = get_user(request)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.newsblur"
|
||||
android:versionCode="119"
|
||||
android:versionName="4.8.0b3" >
|
||||
android:versionName="4.8.0b1" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
|
|
|
@ -47,6 +47,11 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
story_authors: function() {
|
||||
return this.get('story_authors').replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
},
|
||||
|
||||
formatted_short_date: function() {
|
||||
var timestamp = this.get('story_timestamp');
|
||||
var dateformat = NEWSBLUR.assets.preference('dateformat');
|
||||
|
|
|
@ -495,10 +495,10 @@ var classifier_prototype = {
|
|||
)
|
||||
])
|
||||
])),
|
||||
(story.get('story_authors') && $.make('div', { className: 'NB-modal-field NB-fieldset' }, [
|
||||
(story.story_authors() && $.make('div', { className: 'NB-modal-field NB-fieldset' }, [
|
||||
$.make('h5', 'Story Author'),
|
||||
$.make('div', { className: 'NB-fieldset-fields NB-classifiers' },
|
||||
this.make_authors([story.get('story_authors')])
|
||||
this.make_authors([story.story_authors()])
|
||||
)
|
||||
])),
|
||||
(story.get('story_tags').length && $.make('div', { className: 'NB-modal-field NB-fieldset' }, [
|
||||
|
|
|
@ -32,6 +32,8 @@ NEWSBLUR.Views.FeedSelector = Backbone.View.extend({
|
|||
this.$el.show();
|
||||
$input.val('');
|
||||
$input.focus();
|
||||
NEWSBLUR.app.feed_list.options.feed_chooser = true;
|
||||
NEWSBLUR.assets.feeds.trigger('reset');
|
||||
$feed_list.addClass('NB-selector-active');
|
||||
$social_feeds.addClass('NB-selector-active');
|
||||
$body.addClass('NB-selector-active');
|
||||
|
@ -55,6 +57,8 @@ NEWSBLUR.Views.FeedSelector = Backbone.View.extend({
|
|||
$input.blur();
|
||||
this.$el.hide();
|
||||
this.$next_feed = null;
|
||||
NEWSBLUR.app.feed_list.options.feed_chooser = false;
|
||||
NEWSBLUR.assets.feeds.trigger('reset');
|
||||
$feed_list.removeClass('NB-selector-active');
|
||||
$social_feeds.removeClass('NB-selector-active');
|
||||
$body.removeClass('NB-selector-active');
|
||||
|
|
|
@ -170,11 +170,11 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
<% } %>\
|
||||
<%= story.formatted_long_date() %>\
|
||||
</div>\
|
||||
<% if (story.get("story_authors")) { %>\
|
||||
<% if (story.story_authors()) { %>\
|
||||
<div class="NB-feed-story-author-wrapper">\
|
||||
<span class="NB-middot">·</span>\
|
||||
<span class="NB-feed-story-author <% if (authors_score) { %>NB-score-<%= authors_score %><% } %>">\
|
||||
<%= story.get("story_authors") %>\
|
||||
<%= story.story_authors() %>\
|
||||
</span>\
|
||||
</div>\
|
||||
<% } %>\
|
||||
|
|
|
@ -64,7 +64,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
<div class="NB-storytitles-star"></div>\
|
||||
<div class="NB-storytitles-share"></div>\
|
||||
<span class="NB-storytitles-title"><%= story.get("story_title") %></span>\
|
||||
<span class="NB-storytitles-author"><%= story.get("story_authors") %></span>\
|
||||
<span class="NB-storytitles-author"><%= story.story_authors() %></span>\
|
||||
<% if (show_content_preview) { %>\
|
||||
<div class="NB-storytitles-content-preview"><%= show_content_preview %></div>\
|
||||
<% } %>\
|
||||
|
@ -110,7 +110,7 @@ NEWSBLUR.Views.StoryTitleView = Backbone.View.extend({
|
|||
</a>\
|
||||
</div>\
|
||||
<div class="NB-storytitles-grid-bottom">\
|
||||
<span class="NB-storytitles-author"><%= story.get("story_authors") %></span>\
|
||||
<span class="NB-storytitles-author"><%= story.story_authors() %></span>\
|
||||
<span class="story_date NB-hidden-fade"><%= story.formatted_short_date() %></span>\
|
||||
</div>\
|
||||
<% if (story.get("comment_count_friends")) { %>\
|
||||
|
|
Loading…
Add table
Reference in a new issue