From 769405ff3466b1ee91234974e23eaf64b998282c Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Fri, 30 Mar 2018 19:24:51 +0200 Subject: [PATCH 1/4] google subs: make sure the subs can be cancelled if they return a 410 from google (#10201) --- website/server/libs/googlePayments.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/website/server/libs/googlePayments.js b/website/server/libs/googlePayments.js index 2f201cffd2..b73197f4b5 100644 --- a/website/server/libs/googlePayments.js +++ b/website/server/libs/googlePayments.js @@ -140,16 +140,27 @@ api.cancelSubscribe = async function cancelSubscribe (user, headers) { await iap.setup(); - let googleRes = await iap.validate(iap.GOOGLE, plan.additionalData); + let dateTerminated; - let isValidated = iap.isValidated(googleRes); - if (!isValidated) throw new NotAuthorized(this.constants.RESPONSE_INVALID_RECEIPT); + try { + let googleRes = await iap.validate(iap.GOOGLE, plan.additionalData); - let purchases = iap.getPurchaseData(googleRes); - if (purchases.length === 0) throw new NotAuthorized(this.constants.RESPONSE_INVALID_RECEIPT); - let subscriptionData = purchases[0]; + let isValidated = iap.isValidated(googleRes); + if (!isValidated) throw new NotAuthorized(this.constants.RESPONSE_INVALID_RECEIPT); + + let purchases = iap.getPurchaseData(googleRes); + if (purchases.length === 0) throw new NotAuthorized(this.constants.RESPONSE_INVALID_RECEIPT); + let subscriptionData = purchases[0]; + dateTerminated = new Date(Number(subscriptionData.expirationDate)); + } catch (err) { + // Status:410 means that the subsctiption isn't active anymore and we can safely delete it + if (err && err.message === 'Status:410') { + dateTerminated = new Date(); + } else { + throw err; + } + } - let dateTerminated = new Date(Number(subscriptionData.expirationDate)); if (dateTerminated > new Date()) throw new NotAuthorized(this.constants.RESPONSE_STILL_VALID); await payments.cancelSubscription({ From f7b9ca124d43a75713ccd6ff5242aade3761362f Mon Sep 17 00:00:00 2001 From: SabreCat Date: Sun, 1 Apr 2018 02:55:04 +0000 Subject: [PATCH 2/4] feat(event): April Foolery 2018 --- website/client/assets/css/sprites.css | 29 ++++++++++++++++++++++++- website/client/assets/scss/animals.scss | 2 +- website/client/components/avatar.vue | 12 +++++----- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/website/client/assets/css/sprites.css b/website/client/assets/css/sprites.css index 906e3bc5a2..3b50e94b11 100755 --- a/website/client/assets/css/sprites.css +++ b/website/client/assets/css/sprites.css @@ -100,7 +100,34 @@ [class*="Mount_Head_"], [class*="Mount_Body_"] { - margin-top:18px; /* Sprite accommodates 105x123 box */ + margin-top: 18px; /* Sprite accommodates 105x123 box */ + left: 28px; + top: 34px; +} + +[class*="Mount_"], +[class*="Pet-"] { + transform: scale(0.333, 0.333); + -ms-transform: scale(0.333, 0.333); + -webkit-transform: scale(0.333, 0.333); +} + +[class*="_Sabretooth"], +[class*="_TRex"], +[class*="_Wolf"] { + left: 18px; + top: 25px; +} + +[class*="_JackOLantern"] { + left: 32px; +} + +[class*="_Cuttlefish"], +[class*="_Frog"], +[class*="_MagicalBee"], +[class*="_Mammoth"] { + top: 30px; } .Pet_Currency_Gem { diff --git a/website/client/assets/scss/animals.scss b/website/client/assets/scss/animals.scss index a75f6dcb17..ca2bb92043 100644 --- a/website/client/assets/scss/animals.scss +++ b/website/client/assets/scss/animals.scss @@ -7,7 +7,7 @@ left: 0; &:not([class*="FlyingPig"]) { - top: -28px !important; + top: -8px !important; } } diff --git a/website/client/components/avatar.vue b/website/client/components/avatar.vue index a4acea6cc0..e62965e78a 100644 --- a/website/client/components/avatar.vue +++ b/website/client/components/avatar.vue @@ -1,10 +1,6 @@