fix: unwanted check for billing limits

This commit is contained in:
Torsten Dittmann
2024-11-04 13:12:19 +01:00
parent 3d1cc2ee91
commit 794d5b9dc5
4 changed files with 947 additions and 784 deletions
+12 -12
View File
@@ -23,7 +23,7 @@
"@appwrite.io/pink": "0.25.0",
"@appwrite.io/pink-icons": "0.25.0",
"@popperjs/core": "^2.11.8",
"@sentry/sveltekit": "^8.33.1",
"@sentry/sveltekit": "^8.36.0",
"@stripe/stripe-js": "^3.5.0",
"ai": "^2.2.37",
"analytics": "^0.8.14",
@@ -32,7 +32,7 @@
"deep-equal": "^2.2.3",
"echarts": "^5.5.1",
"envfile": "^7.1.0",
"nanoid": "^5.0.7",
"nanoid": "^5.0.8",
"plausible-tracker": "^0.3.9",
"pretty-bytes": "^6.1.1",
"prismjs": "^1.29.0",
@@ -42,35 +42,35 @@
"devDependencies": {
"@melt-ui/pp": "^0.3.2",
"@melt-ui/svelte": "^0.83.0",
"@playwright/test": "^1.48.0",
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.6.4",
"@playwright/test": "^1.48.2",
"@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/kit": "^2.7.4",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/svelte": "^5.2.3",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/svelte": "^5.2.4",
"@testing-library/user-event": "^14.5.2",
"@types/deep-equal": "^1.0.4",
"@types/prismjs": "^1.26.4",
"@types/prismjs": "^1.26.5",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitest/ui": "^1.6.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.44.1",
"eslint-plugin-svelte": "^2.46.0",
"jsdom": "^22.1.0",
"kleur": "^4.1.5",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.7",
"sass": "^1.79.4",
"sass": "^1.80.6",
"svelte": "^4.2.19",
"svelte-check": "^3.8.6",
"svelte-jester": "^2.3.2",
"svelte-preprocess": "^6.0.3",
"svelte-sequential-preprocessor": "^2.0.2",
"tslib": "^2.7.0",
"tslib": "^2.8.1",
"typescript": "^5.6.3",
"vite": "^5.4.8",
"vite": "^5.4.10",
"vitest": "^1.6.0"
},
"type": "module",
+916 -765
View File
File diff suppressed because it is too large Load Diff
+8 -3
View File
@@ -8,7 +8,7 @@
import Shell from '$lib/layout/shell.svelte';
import { app } from '$lib/stores/app';
import { log } from '$lib/stores/logs';
import { newOrgModal, organization } from '$lib/stores/organization';
import { newOrgModal, organization, type Organization } from '$lib/stores/organization';
import { database, checkForDatabaseBackupPolicies } from '$lib/stores/database';
import { wizard } from '$lib/stores/wizard';
import { afterUpdate, onMount } from 'svelte';
@@ -275,9 +275,12 @@
await checkForDatabaseBackupPolicies(database);
});
organization.subscribe(async (org) => {
let currentOrganizationId = null;
async function checkForUsageLimits(org: Organization) {
if (!org) return;
if (currentOrganizationId === org.$id) return;
if (isCloud) {
currentOrganizationId = org.$id;
await checkForUsageLimit(org);
checkForMarkedForDeletion(org);
await checkForNewDevUpgradePro(org);
@@ -293,7 +296,9 @@
}
$activeHeaderAlert = headerAlert.get();
}
});
}
$: checkForUsageLimits($organization);
$: if (!$log.show) {
$log.data = null;
@@ -13,9 +13,16 @@ export const load: LayoutLoad = async ({ params, depends }) => {
try {
const project = await sdk.forConsole.projects.get(params.project);
const prefs = await sdk.forConsole.account.getPrefs();
const newPrefs = { ...prefs, organization: project.teamId };
sdk.forConsole.account.updatePrefs(newPrefs);
const [organization, prefs] = await Promise.all([
sdk.forConsole.teams.get(project.teamId) as Promise<Organization>,
sdk.forConsole.account.getPrefs()
]);
if (prefs?.organization !== project.teamId) {
sdk.forConsole.account.updatePrefs({
...prefs,
organization: project.teamId
});
}
preferences.loadTeamPrefs(project.teamId);
let roles = isCloud ? [] : defaultRoles;
let scopes = isCloud ? [] : defaultScopes;
@@ -30,7 +37,7 @@ export const load: LayoutLoad = async ({ params, depends }) => {
return {
project,
organization: await (sdk.forConsole.teams.get(project.teamId) as Promise<Organization>),
organization,
roles,
scopes
};