Fixes for conflicts

This commit is contained in:
David Bomba 2022-06-30 13:33:47 +10:00
commit f59c2dc57f
4 changed files with 38 additions and 3 deletions

View File

@ -11,6 +11,7 @@
namespace App\Factory; namespace App\Factory;
use App\Models\CompanyUser;
use App\Models\User; use App\Models\User;
class UserFactory class UserFactory

View File

@ -308,6 +308,7 @@ class NinjaMailerJob implements ShouldQueue
private function preFlightChecksFail() private function preFlightChecksFail()
{ {
/* If we are migrating data we don't want to fire any emails */ /* If we are migrating data we don't want to fire any emails */
if($this->nmo->company->is_disabled && !$this->override) if($this->nmo->company->is_disabled && !$this->override)
return true; return true;
@ -324,6 +325,9 @@ class NinjaMailerJob implements ShouldQueue
if(Ninja::isHosted() && $this->company->account && $this->company->account->emailQuotaExceeded()) if(Ninja::isHosted() && $this->company->account && $this->company->account->emailQuotaExceeded())
return true; return true;
if(Ninja::isHosted() && $this->company->account && $this->nmo->company->account->is_flagged)
return true;
/* Ensure the user has a valid email address */ /* Ensure the user has a valid email address */
if(!str_contains($this->nmo->to_user->email, "@")) if(!str_contains($this->nmo->to_user->email, "@"))
return true; return true;

View File

@ -373,8 +373,8 @@ class Account extends BaseModel
public function getDailyEmailLimit() public function getDailyEmailLimit()
{ {
if(Carbon::createFromTimestamp($this->created_at)->diffInDays() == 0) if($this->is_flagged)
return 7; return 0;
if(Carbon::createFromTimestamp($this->created_at)->diffInWeeks() == 0) if(Carbon::createFromTimestamp($this->created_at)->diffInWeeks() == 0)
return 20; return 20;

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFlagToAccountsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('accounts', function (Blueprint $table) {
$table->boolean('is_flagged')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}