-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a block if an admin contact email has not been set.
See eveseat/seat#77
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,10 @@ | |
namespace Seat\Eveapi\Traits; | ||
|
||
use Illuminate\Foundation\Bus\DispatchesJobs; | ||
use Log; | ||
use Seat\Eveapi\Helpers\JobContainer; | ||
use Seat\Eveapi\Models\JobTracking; | ||
use Seat\Services\Settings\Seat; | ||
|
||
/** | ||
* Class JobManager | ||
|
@@ -46,6 +48,17 @@ trait JobManager | |
public function addUniqueJob($job, JobContainer $args) | ||
{ | ||
|
||
// Refuse to pop a job onto the queue if the admin | ||
// has not yet configured an administrative contact. | ||
// See: https://github.com/eveseat/seat/issues/77 (Request by CCP) | ||
if ($this->hasDefaultAdminContact()) { | ||
|
||
Log::error( | ||
'Default admin contact still set. Not queuing job for: ' . $args->api); | ||
|
||
return 'Failed to queue due to default config'; | ||
} | ||
|
||
// Look for an existing job | ||
$job_id = JobTracking::where('owner_id', $args->owner_id) | ||
->where('api', $args->api) | ||
|
@@ -82,4 +95,19 @@ public function addUniqueJob($job, JobContainer $args) | |
return $job_id; | ||
|
||
} | ||
|
||
/** | ||
* Checks if the administrative contact has been | ||
* configured | ||
* | ||
* @return bool | ||
*/ | ||
public function hasDefaultAdminContact() | ||
{ | ||
|
||
if (Seat::get('admin_contact') === '[email protected]') | ||
return true; | ||
|
||
return false; | ||
} | ||
} |