1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Make email sync not remove email account if premium

This commit is contained in:
Uncled1023 2021-11-30 20:33:34 -08:00
parent 98c99b3336
commit 2e945e7d9d
3 changed files with 13 additions and 6 deletions

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks;
using CommandLine; using CommandLine;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Teknik.Areas.Billing; using Teknik.Areas.Billing;
@ -72,7 +73,7 @@ namespace Teknik.BillingService
return -1; return -1;
} }
public static void SyncSubscriptions(Config config, TeknikEntities db) public static async Task SyncSubscriptions(Config config, TeknikEntities db)
{ {
// Get Biling Service // Get Biling Service
var billingService = BillingFactory.GetBillingService(config.BillingConfig); var billingService = BillingFactory.GetBillingService(config.BillingConfig);
@ -117,6 +118,12 @@ namespace Teknik.BillingService
} }
else else
{ {
// Only reset their email size limit if they are premium
var userInfo = await IdentityHelper.GetIdentityUserInfo(config, user.Username);
if (userInfo != null &&
userInfo.AccountType == AccountType.Premium)
BillingHelper.SetEmailLimits(config, user, config.EmailConfig.MaxSize, true);
else
BillingHelper.SetEmailLimits(config, user, config.EmailConfig.MaxSize, false); BillingHelper.SetEmailLimits(config, user, config.EmailConfig.MaxSize, false);
} }
} }

View File

@ -35,8 +35,8 @@
"url": "https://git.teknik.io/Teknikode/Teknik" "url": "https://git.teknik.io/Teknikode/Teknik"
}, },
"scripts": { "scripts": {
"pre-publish": "npm install && gulp clean && gulp copy-assets && gulp watch", "pre-publish": "npm install && gulp clean && gulp copy-assets",
"build": "npm install && gulp clean && gulp copy-assets && gulp min && gulp update-version", "build": "npm install && gulp eslint && gulp clean && gulp copy-assets && gulp load-bundle && gulp min && gulp update-version",
"gulp": "gulp" "gulp": "gulp"
}, },
"version": "2.1.0" "version": "2.1.0"

View File

@ -57,8 +57,8 @@
"url": "https://git.teknik.io/Teknikode/Teknik" "url": "https://git.teknik.io/Teknikode/Teknik"
}, },
"scripts": { "scripts": {
"pre-publish": "npm install && gulp clean && gulp copy-assets && gulp watch", "pre-publish": "npm install && gulp clean && gulp copy-assets",
"build": "npm install && gulp eslint && gulp clean && gulp copy-assets && gulp min && gulp update-version", "build": "npm install && gulp eslint && gulp clean && gulp copy-assets && gulp load-bundle && gulp min && gulp update-version",
"gulp": "gulp" "gulp": "gulp"
}, },
"version": "2.1.0" "version": "2.1.0"