Welcome all users to their status page

This commit is contained in:
James Brooks
2016-08-23 13:09:47 +01:00
parent 1b96420fc9
commit 6685ae96d8
13 changed files with 312 additions and 25 deletions

View File

@@ -11,17 +11,24 @@
namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
use CachetHQ\Cachet\Bus\Commands\User\WelcomeUserCommand;
use CachetHQ\Cachet\Integrations\Contracts\Feed;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\ComponentGroup;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use Jenssegers\Date\Date;
/**
* This is the dashboard controller class.
*
* @author James Brooks <james@alt-three.com>
*/
class DashboardController extends Controller
{
/**
@@ -83,6 +90,11 @@ class DashboardController extends Controller
$componentGroups = ComponentGroup::whereIn('id', $usedComponentGroups)->orderBy('order')->get();
$ungroupedComponents = Component::enabled()->where('group_id', 0)->orderBy('order')->orderBy('created_at')->get();
$welcomeUser = !Auth::user()->welcomed;
if ($welcomeUser) {
dispatch(new WelcomeUserCommand(Auth::user()));
}
$entries = null;
if ($feed = $this->feed->latest()) {
$entries = array_slice($feed->channel->item, 0, 5);
@@ -95,7 +107,8 @@ class DashboardController extends Controller
->withSubscribers($subscribers)
->withEntries($entries)
->withComponentGroups($componentGroups)
->withUngroupedComponents($ungroupedComponents);
->withUngroupedComponents($ungroupedComponents)
->withWelcomeUser($welcomeUser);
}
/**

View File

@@ -22,7 +22,6 @@ use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\View;
@@ -217,8 +216,6 @@ class SetupController extends Controller
$this->writeEnv($envKey, $envValue);
}
Session::flash('setup.done', true);
if (Request::ajax()) {
return Response::json(['status' => 1]);
}