refactor: only get instanceSettings once from db

This commit is contained in:
Andras Bacsai
2024-07-12 12:51:55 +02:00
parent 21612cccf7
commit 88f33be5b6
23 changed files with 54 additions and 51 deletions

View File

@@ -48,7 +48,7 @@ class Help extends Component
]
);
$mail->subject("[HELP]: {$this->subject}");
$settings = InstanceSettings::get();
$settings = view()->shared('instanceSettings');
$type = set_transanctional_email_settings($settings);
if (! $type) {
$url = 'https://app.coolify.io/api/feedback';

View File

@@ -173,7 +173,7 @@ class Email extends Component
public function copyFromInstanceSettings()
{
$settings = InstanceSettings::get();
$settings = view()->shared('instanceSettings');
if ($settings->smtp_enabled) {
$team = currentTeam();
$team->update([

View File

@@ -29,6 +29,8 @@ class Webhooks extends Component
public function mount()
{
// ray()->clearAll();
// ray()->showQueries();
$this->deploywebhook = generateDeployWebhook($this->resource);
$this->githubManualWebhookSecret = data_get($this->resource, 'manual_webhook_secret_github');

View File

@@ -18,7 +18,7 @@ class Index extends Component
public function mount()
{
if (isInstanceAdmin()) {
$settings = InstanceSettings::get();
$settings = view()->shared('instanceSettings');
$database = StandalonePostgresql::whereName('coolify-db')->first();
$s3s = S3Storage::whereTeamId(0)->get() ?? [];
if ($database) {

View File

@@ -29,7 +29,7 @@ class License extends Component
abort(404);
}
$this->instance_id = config('app.id');
$this->settings = InstanceSettings::get();
$this->settings = view()->shared('instanceSettings');
}
public function render()

View File

@@ -100,7 +100,7 @@ class Change extends Component
return redirect()->route('source.all');
}
$this->applications = $this->github_app->applications;
$settings = InstanceSettings::get();
$settings = view()->shared('instanceSettings');
$this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret');
$this->name = str($this->github_app->name)->kebab();

View File

@@ -23,7 +23,7 @@ class Index extends Component
if (data_get(currentTeam(), 'subscription') && isSubscriptionActive()) {
return redirect()->route('subscription.show');
}
$this->settings = InstanceSettings::get();
$this->settings = view()->shared('instanceSettings');
$this->alreadySubscribed = currentTeam()->subscription()->exists();
}