Merge remote-tracking branch 'upstream/master'

Conflicts:
	clients/android/NewsBlur/src/com/newsblur/service/NBSyncService.java
This commit is contained in:
dosiecki 2015-01-06 02:57:44 -08:00
commit 868b85e0d5
7 changed files with 22 additions and 14 deletions

View file

@ -219,7 +219,7 @@ class Profile(models.Model):
self.user.save()
self.send_new_user_queue_email()
def setup_premium_history(self, alt_email=None):
def setup_premium_history(self, alt_email=None, check_premium=False):
paypal_payments = []
stripe_payments = []
existing_history = PaymentHistory.objects.filter(user=self.user,
@ -282,6 +282,9 @@ class Profile(models.Model):
logging.user(self.user, "~BY~SN~FWFound ~SB%s paypal~SN and ~SB%s stripe~SN payments (~SB%s payments expire: ~SN~FB%s~FW)" % (
len(paypal_payments), len(stripe_payments), len(payment_history), self.premium_expire))
if check_premium and self.premium_expire > datetime.datetime.now() and not self.is_premium:
self.activate_premium()
def refund_premium(self, partial=False):
refunded = False
@ -723,7 +726,7 @@ def paypal_payment_history_sync(sender, **kwargs):
user = User.objects.get(email__iexact=ipn_obj.payer_email)
logging.user(user, "~BC~SB~FBPaypal subscription payment")
try:
user.profile.setup_premium_history()
user.profile.setup_premium_history(check_premium=True)
except:
return {"code": -1, "message": "User doesn't exist."}
payment_was_successful.connect(paypal_payment_history_sync)
@ -737,7 +740,7 @@ def paypal_payment_was_flagged(sender, **kwargs):
user = User.objects.get(email__iexact=ipn_obj.payer_email)
logging.user(user, "~BC~SB~FBPaypal subscription payment flagged")
try:
user.profile.setup_premium_history()
user.profile.setup_premium_history(check_premium=True)
except:
return {"code": -1, "message": "User doesn't exist."}
payment_was_flagged.connect(paypal_payment_was_flagged)
@ -750,7 +753,7 @@ def paypal_recurring_payment_history_sync(sender, **kwargs):
user = User.objects.get(email__iexact=ipn_obj.payer_email)
logging.user(user, "~BC~SB~FBPaypal subscription recurring payment")
try:
user.profile.setup_premium_history()
user.profile.setup_premium_history(check_premium=True)
except:
return {"code": -1, "message": "User doesn't exist."}
recurring_payment.connect(paypal_recurring_payment_history_sync)
@ -770,7 +773,7 @@ def stripe_payment_history_sync(sender, full_json, **kwargs):
try:
profile = Profile.objects.get(stripe_id=stripe_id)
logging.user(profile.user, "~BC~SB~FBStripe subscription payment")
profile.setup_premium_history()
profile.setup_premium_history(check_premium=True)
except Profile.DoesNotExist:
return {"code": -1, "message": "User doesn't exist."}
zebra_webhook_charge_succeeded.connect(stripe_payment_history_sync)

View file

@ -1519,7 +1519,12 @@ def mark_feed_as_read(request):
for feed_id in feed_ids:
if 'social:' in feed_id:
user_id = int(feed_id.replace('social:', ''))
sub = MSocialSubscription.objects.get(user_id=request.user.pk, subscription_user_id=user_id)
try:
sub = MSocialSubscription.objects.get(user_id=request.user.pk,
subscription_user_id=user_id)
except MSocialSubscription.DoesNotExist:
logging.user(request, "~FRCouldn't find socialsub: %s" % user_id)
continue
if not multiple:
sub_user = User.objects.get(pk=sub.subscription_user_id)
logging.user(request, "~FMMarking social feed as read: ~SB%s" % (sub_user.username,))

View file

@ -2613,7 +2613,7 @@ class MSocialServices(mongo.Document):
try:
api = self.twitter_api()
me = api.me()
except tweepy.TweepError, e:
except (tweepy.TweepError, TypeError), e:
logging.user(user, "~FRException (%s): ~FCsetting to blank profile photo" % e)
self.twitter_picture_url = None
self.set_photo("nothing")

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="80"
android:versionName="4.0.2" >
android:versionCode="82"
android:versionName="4.1.0b1" >
<uses-sdk
android:minSdkVersion="11"

View file

@ -54,10 +54,10 @@ public class AppConstants {
public static final int MAX_READ_STORIES_STORED = 500;
// how many unread stories to fetch via hash at a time
public static final int UNREAD_FETCH_BATCH_SIZE = 50;
public static final int UNREAD_FETCH_BATCH_SIZE = 100;
// how many images to prefetch before updating the countdown UI
public static final int IMAGE_PREFETCH_BATCH_SIZE = 10;
public static final int IMAGE_PREFETCH_BATCH_SIZE = 6;
// should the feedback link be enabled (read: is this a beta?)
public static final boolean ENABLE_FEEDBACK = true;

View file

@ -30,7 +30,7 @@
-(id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType {
if ([activityType isEqualToString:UIActivityTypeMail] ||
[activityType isEqualToString:@"com.evernote.iPhone.Evernote.EvernoteShare"]) {
return @{@"body": text, @"subject": title};
return @{@"body": text ?: @"", @"subject": title};
} else if ([activityType isEqualToString:UIActivityTypePostToTwitter] ||
[activityType isEqualToString:UIActivityTypePostToFacebook] ||
[activityType isEqualToString:UIActivityTypePostToWeibo]) {

4
fabfile.py vendored
View file

@ -1023,7 +1023,7 @@ def setup_original_page_server():
sudo('supervisorctl reload')
def setup_elasticsearch():
ES_VERSION = "0.90.0"
ES_VERSION = "0.90.13"
sudo('apt-get update')
sudo('apt-get install openjdk-7-jre -y')
@ -1032,7 +1032,7 @@ def setup_elasticsearch():
with cd(os.path.join(env.VENDOR_PATH, 'elasticsearch-%s' % ES_VERSION)):
run('wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-%s.deb' % ES_VERSION)
sudo('dpkg -i elasticsearch-%s.deb' % ES_VERSION)
sudo('/usr/share/elasticsearch/bin/plugin -install mobz/elasticsearch-head' % ES_VERSION)
sudo('/usr/share/elasticsearch/bin/plugin -install mobz/elasticsearch-head')
def setup_db_search():
put('config/supervisor_celeryd_search_indexer.conf', '/etc/supervisor/conf.d/celeryd_search_indexer.conf', use_sudo=True)