Merge remote-tracking branch 'upstream/master'

This commit is contained in:
dosiecki 2017-06-14 12:49:05 -07:00
commit c4e08a5ed3
15 changed files with 55 additions and 23 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.newsblur"
android:versionCode="139"
android:versionName="5.2.0b4" >
android:versionCode="141"
android:versionName="6.0.0" >
<uses-sdk
android:minSdkVersion="19"

View file

@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:2.3.3'
}
}

View file

@ -1427,6 +1427,8 @@
}
- (void)redrawUnreadStory {
[MBProgressHUD hideHUDForView:self.view animated:YES];
NSInteger rowIndex = [storiesCollection locationOfActiveStory];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0];
FeedDetailTableCell *cell = (FeedDetailTableCell*) [self.storyTitlesTable cellForRowAtIndexPath:indexPath];

View file

@ -429,6 +429,9 @@
withNewUserProfiles:userProfiles];
[self replaceStory:[results objectForKey:@"story"] withReplyId:nil];
[appDelegate.feedDetailViewController redrawUnreadStory];
[MBProgressHUD hideHUDForView:appDelegate.storyPageControl.view animated:NO];
[MBProgressHUD hideHUDForView:appDelegate.storyPageControl.currentPage.view animated:NO];
}
# pragma mark

View file

@ -58,7 +58,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>77</string>
<string>78</string>
<key>FacebookAppID</key>
<string>230426707030569</string>
<key>ITSAppUsesNonExemptEncryption</key>

View file

@ -69,7 +69,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="textColor" red="0.33333333333333331" green="0.33333333333333331" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="12"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="emailAddress" returnKeyType="search" enablesReturnKeyAutomatically="YES"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="URL" returnKeyType="search" enablesReturnKeyAutomatically="YES"/>
<connections>
<action selector="checkSiteAddress" destination="-1" eventType="editingChanged" id="60"/>
<action selector="checkSiteAddress" destination="-1" eventType="editingDidBegin" id="70"/>

2
fabfile.py vendored
View file

@ -1479,7 +1479,7 @@ def role_for_host():
@parallel
def deploy(fast=False, reload=False):
role = role_for_host()
if role in ['work', 'search']:
if role in ['work', 'search', 'debug']:
deploy_code(copy_assets=False, fast=fast, reload=True)
else:
deploy_code(copy_assets=False, fast=fast, reload=reload)

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 KiB

View file

@ -69,14 +69,26 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
midnight.setSeconds(0);
return midnight;
};
var midnight_tomorrow = function(midnight, days) {
if (!days) days = 1;
return new Date(midnight.getTime() + days*60*60*24*1000);
};
var midnight_yesterday = function(midnight) {
return new Date(midnight - 60*60*24*1000);
return midnight_tomorrow(midnight, -1);
};
var midnight = midnight_today();
var time = date.format(dateformat == "24" ? "H:i" : "g:ia");
if (date > midnight) {
return time;
if (date > midnight_tomorrow(midnight)) {
if (date < midnight_tomorrow(midnight, 2)) {
return "Tomorrow, " + time;
} else {
return date.format("d M Y, ") + time;
}
} else {
return time;
}
} else if (date > midnight_yesterday(midnight)) {
return "Yesterday, " + time;
} else {
@ -95,8 +107,12 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
midnight.setSeconds(0);
return midnight;
};
var midnight_tomorrow = function(midnight, days) {
if (!days) days = 1;
return new Date(midnight.getTime() + days*60*60*24*1000);
};
var midnight_yesterday = function(midnight) {
return new Date(midnight - 60*60*24*1000);
return midnight_tomorrow(midnight, -1);
};
var beginning_of_month = function() {
var month = new Date();
@ -109,7 +125,15 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
var midnight = midnight_today();
var time = date.format(dateformat == "24" ? "H:i" : "g:ia");
if (date > midnight) {
return "Today, " + date.format("F jS ") + time;
if (date > midnight_tomorrow(midnight)) {
if (date < midnight_tomorrow(midnight, 2)) {
return "Tomorrow, " + date.format("F jS ") + time;
} else {
return date.format("l, F jS Y ") + time;
}
} else {
return "Today, " + date.format("F jS ") + time;
}
} else if (date > midnight_yesterday(midnight)) {
return "Yesterday, " + date.format("F jS ") + time;
} else if (date > beginning_of_month()) {

View file

@ -1465,6 +1465,9 @@
var feed_title = feed.get('feed_title') || '';
var slug = _.string.words(_.string.clean(feed_title.replace(/[^a-z0-9\. ]/ig, ''))).join('-').toLowerCase();
var url = "site/" + feed.id + "/" + slug;
if (window.location.search.length) {
url = url + window.location.search;
}
if (!_.string.include(window.location.pathname, url)) {
NEWSBLUR.log(["Navigating to url", url]);
NEWSBLUR.router.navigate(url);
@ -3366,10 +3369,10 @@
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Goodies &amp; Mobile Apps')
]),
(NEWSBLUR.Globals.is_admin && $.make('li', { className: 'NB-menu-item NB-menu-manage-notifications' }, [
$.make('li', { className: 'NB-menu-item NB-menu-manage-notifications' }, [
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Notifications')
])),
]),
$.make('li', { className: 'NB-menu-item NB-menu-manage-newsletters' }, [
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Email Newsletters')
@ -3428,10 +3431,10 @@
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Site settings')
]),
(NEWSBLUR.Globals.is_admin && $.make('li', { className: 'NB-menu-item NB-menu-manage-feed-notifications' }, [
$.make('li', { className: 'NB-menu-item NB-menu-manage-feed-notifications' }, [
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Notifications')
])),
]),
$.make('li', { className: 'NB-menu-item NB-menu-manage-feed-train' }, [
$.make('div', { className: 'NB-menu-manage-image' }),
$.make('div', { className: 'NB-menu-manage-title' }, 'Intelligence trainer'),

View file

@ -88,7 +88,7 @@ NEWSBLUR.FeedOptionsPopover = NEWSBLUR.ReaderPopover.extend({
$.make('div', { className: 'NB-stat' }, "Fetched every " + NEWSBLUR.utils.calculate_update_interval(feed.get('min_to_decay')))
]))
])),
(feed && NEWSBLUR.Globals.is_staff && $.make('div', { className: 'NB-popover-section' }, [
(feed && $.make('div', { className: 'NB-popover-section' }, [
$.make('div', { className: 'NB-section-icon NB-filter-popover-notifications-icon' }),
$.make('div', { className: 'NB-popover-section-title' }, 'Notifications'),
$.make('div', { className: 'NB-feedbar-options-notifications' }, [

View file

@ -48,14 +48,12 @@
Goodies &amp; Apps
</div>
</li>
{% if user.is_staff %}
<li class="NB-menu-item NB-menu-manage-notifications">
<div class="NB-menu-manage-image"></div>
<div class="NB-menu-manage-title">
Notifications
</div>
</li>
{% endif %}
<li class="NB-menu-item NB-menu-manage-newsletters">
<div class="NB-menu-manage-image"></div>
<div class="NB-menu-manage-title">

View file

@ -208,7 +208,10 @@ class TwitterFetcher:
tweet_title = user_tweet['full_text']
tweet_text = linebreaks(content_tweet['full_text'])
replaced = {}
for media in content_tweet['entities'].get('media', []):
entities_media = content_tweet['entities'].get('media', [])
if 'extended_entities' in content_tweet:
entities_media = content_tweet['extended_entities'].get('media', [])
for media in entities_media:
if 'media_url_https' not in media: continue
if media['type'] == 'photo':
if media.get('url') and media['url'] in tweet_text:

View file

@ -4,7 +4,6 @@ import logging
import re
import sys
from collections import defaultdict
from lxml.etree import tostring
from lxml.etree import tounicode
from lxml.html import document_fromstring
@ -26,7 +25,7 @@ REGEXES = {
'unlikelyCandidatesRe': re.compile('combx|comment|community|disqus|extra|foot|header|menu|remark|rss|shoutbox|sidebar|sponsor|ad-break|agegate|pagination|pager|popup|tweet|twitter', re.I),
'okMaybeItsACandidateRe': re.compile('and|article|body|column|main|shadow', re.I),
'positiveRe': re.compile('article|body|content|entry|hentry|main|page|pagination|post|text|blog|story', re.I),
'negativeRe': re.compile('combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|shoutbox|sidebar|sponsor|shopping|tags|tool|widget', re.I),
'negativeRe': re.compile('combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|shoutbox|sidebar|sponsor|shopping|tags|tool|widget|noscript', re.I),
'divToPElementsRe': re.compile('<(a|blockquote|dl|div|img|ol|p|pre|table|ul)', re.I),
#'replaceBrsRe': re.compile('(<br[^>]*>[ \n\r\t]*){2,}',re.I),
#'replaceFontsRe': re.compile('<(\/?)font[^>]*>',re.I),
@ -175,7 +174,7 @@ class Document:
ruthless = True
while True:
self._html(True)
for i in self.tags(self.html, 'script', 'style'):
for i in self.tags(self.html, 'script', 'style', 'noscript'):
i.drop_tree()
for i in self.tags(self.html, 'body'):
i.set('id', 'readabilityBody')
@ -503,8 +502,8 @@ class Document:
to_remove = False
reason = ""
if el.tag == 'div' and counts["img"] >= 1:
continue
#if el.tag == 'div' and counts["img"] >= 1:
# continue
if counts["p"] and counts["img"] > 1+counts["p"]*1.3:
reason = "too many images (%s)" % counts["img"]
to_remove = True