Skip to content

Commit

Permalink
Add a block if an admin contact email has not been set.
Browse files Browse the repository at this point in the history
  • Loading branch information
leonjza committed Apr 29, 2016
1 parent 459d353 commit e9db18e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/Traits/JobManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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;
}
}

0 comments on commit e9db18e

Please sign in to comment.