Skip to content

Commit

Permalink
fix notification
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Aug 8, 2024
1 parent f3882f0 commit bfb5bc6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions app/Http/Controllers/EntityHfdController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
namespace App\Http\Controllers;

use App\Facades\HfdTag;
use App\Mail\NewIdentityProvider;
use App\Models\Entity;
use App\Notifications\EntityAddedToHfd;
use App\Notifications\EntityDeletedFromHfd;
use App\Services\NotificationService;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;

class EntityHfdController extends Controller
{
Expand All @@ -29,21 +34,16 @@ public function update(Entity $entity)
return $entity;
});

if ($entity->hfd) {
NotificationService::sendOperatorNotification($entity->operators, new EntityAddedToHfd($entity));
} else {
Mail::to(config('mail.ra.address'))->send(new NewIdentityProvider($entity));
NotificationService::sendOperatorNotification($entity->operators, new EntityDeletedFromHfd($entity));
}

$status = $entity->hfd ? 'hfd' : 'no_hfd';
$color = $entity->hfd ? 'red' : 'green';

//TODO change HfD status (not working)
/* if ($entity->hfd) {
GitAddToHfd::dispatch($entity, Auth::user());
Notification::send($entity->operators, new EntityAddedToHfd($entity));
Notification::send(User::activeAdmins()->select('id', 'email')->get(), new EntityAddedToHfd($entity));
} else {
GitDeleteFromHfd::dispatch($entity, Auth::user());
Mail::to(config('mail.ra.address'))->send(new NewIdentityProvider($entity));
Notification::send($entity->operators, new EntityDeletedFromHfd($entity));
Notification::send(User::activeAdmins()->select('id', 'email')->get(), new EntityDeletedFromHfd($entity));
}*/

return redirect()
->route('entities.show', $entity)
->with('status', __("entities.$status"))
Expand Down

0 comments on commit bfb5bc6

Please sign in to comment.