Skip to content

Commit

Permalink
Update from upstream repo CachetHQ/Cachet (#4)
Browse files Browse the repository at this point in the history
* System status now ignores hidden groups for guests - Fixes cachethq#2577

* Fix typo

* Update deps

* Update github-markdown

* Compile assets

* Switch to using Laravel Mix. Closes cachethq#2582

* Remove gulp dependency

* Fixes Date issue with incident dates being incorrect (as only loading out the date, not the time)

* Fix a spacing issue within text

* Fixes cachethq#2579

* Check if GLOB_BRACE is defined before using it. Fixes cachethq#2586

* Add comment as to why we define GLOB_BRACE as 0

* Prevent subscibing to internal components when not logged in

Fixes cachethq#2520

* Fixes incorrect timestamp on Scheduled Maintenances

Fixes cachethq#2578

* Add missing dev dependency

* Extend BrowserKitTesting TestCase class
  • Loading branch information
backstroke-bot authored and Jesus Zapata committed Jun 25, 2017
1 parent 438862e commit 5eaba3c
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 13 deletions.
7 changes: 6 additions & 1 deletion app/Foundation/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ public function map(Router $router)
$router->group(['namespace' => $this->namespace, 'as' => 'core::'], function (Router $router) {
$path = app_path('Http/Routes');

foreach (glob("{$path}/*{,/*}.php", GLOB_BRACE) as $file) {
// GLOB_BRACE is defined as 0, check the source!
// https://github.com/php/php-src/blob/31e4afe3c3654f9c5ab2eafa3a02c62d41c58b47/ext/standard/dir.c#L154-L158
$globBrace = defined('GLOB_BRACE') ? GLOB_BRACE : 0;
$globFlag = $globBrace;

foreach (glob("{$path}/*{,/*}.php", $globFlag) as $file) {
$class = substr($file, strlen($path));
$class = str_replace('/', '\\', $class);
$class = substr($class, 0, -4);
Expand Down
26 changes: 24 additions & 2 deletions app/Http/Controllers/SubscribeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use CachetHQ\Cachet\Models\Subscription;
use GrahamCampbell\Binput\Facades\Binput;
use GrahamCampbell\Markdown\Facades\Markdown;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Config;
Expand All @@ -37,6 +38,25 @@
*/
class SubscribeController extends Controller
{
/**
* The illuminate guard instance.
*
* @var \Illuminate\Contracts\Auth\Guard
*/
protected $auth;

/**
* Create a new subscribe controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
*
* @return void
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}

/**
* Show the subscribe by email page.
*
Expand Down Expand Up @@ -146,10 +166,12 @@ public function showManage($code = null)
throw new NotFoundHttpException();
}

$includePrivate = $this->auth->check();

$subscriber = Subscriber::where('verify_code', '=', $code)->first();
$usedComponentGroups = Component::enabled()->where('group_id', '>', 0)->groupBy('group_id')->pluck('group_id');
$usedComponentGroups = Component::enabled()->authenticated($includePrivate)->where('group_id', '>', 0)->groupBy('group_id')->pluck('group_id');
$componentGroups = ComponentGroup::whereIn('id', $usedComponentGroups)->orderBy('order')->get();
$ungroupedComponents = Component::enabled()->where('group_id', '=', 0)->orderBy('order')->orderBy('created_at')->get();
$ungroupedComponents = Component::enabled()->authenticated($includePrivate)->where('group_id', '=', 0)->orderBy('order')->orderBy('created_at')->get();

if (!$subscriber) {
throw new BadRequestHttpException();
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Incident.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Incident extends Model implements HasPresenter
protected $casts = [
'visible' => 'int',
'stickied' => 'bool',
'occurred_at' => 'date',
'occurred_at' => 'datetime',
'deleted_at' => 'date',
];

Expand Down
4 changes: 2 additions & 2 deletions app/Models/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class Schedule extends Model implements HasPresenter
'name' => 'string',
'message' => 'string',
'status' => 'int',
'scheduled_at' => 'date',
'completed_at' => 'date',
'scheduled_at' => 'datetime',
'completed_at' => 'datetime',
];

/**
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"twig/twig": "^1.26.1"
},
"require-dev": {
"ext-sqlite3": "*",
"alt-three/testbench": "^1.11",
"brianium/paratest": "^0.15.0",
"filp/whoops": "^2.1",
Expand Down
6 changes: 3 additions & 3 deletions resources/lang/en/cachet.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@

// Service Status
'service' => [
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The system is experiencing major issues|[2,Inf] Some systems are experiencing major issues',
'good' => '[0,1]System operational|[2,Inf] All systems are operational',
'bad' => '[0,1]The system is experiencing issues|[2,Inf]Some systems are experiencing issues',
'major' => '[0,1]The system is experiencing major issues|[2,Inf]Some systems are experiencing major issues',
],

'api' => [
Expand Down
4 changes: 2 additions & 2 deletions resources/lang/en/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
'incidents' => [
'title' => 'Incidents & Schedule',
'incidents' => 'Incidents',
'logged' => '{0} There are no incidents, good work.|You have logged one incident.|You have reported <strong>:count</strong> incidents.',
'logged' => '{0} There are no incidents, good work.|[1] You have logged one incident.|[2, Inf] You have reported <strong>:count</strong> incidents.',
'incident-create-template' => 'Create Template',
'incident-templates' => 'Incident Templates',
'updates' => '{0} Zero Updates|One Update|:count Updates',
'updates' => '{0} Zero Updates|[1] One Update|[2] Two Updates|[3,Inf] Several Updates',
'add' => [
'title' => 'Report an incident',
'success' => 'Incident added.',
Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboard/incidents/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@foreach($incidents as $incident)
<div class="row striped-list-item">
<div class="col-xs-6">
<i class="{{ $incident->icon }}"></i> <a href="{{ cachet_route('dashboard.incidents.edit', [$incident->id]) }}"><strong>{{ $incident->name }}</strong></a> <span class="badge badge-info">{{ trans_choice('dashboard.incidents.updates', $incident->updates->count()) }}</span>
<i class="{{ $incident->icon }}"></i> <a href="{{ cachet_route('dashboard.incidents.edit', [$incident->id]) }}"><strong>{{ $incident->name }}</strong></a> <span class="badge badge-info">{{ trans_choice('dashboard.incidents.updates', $incident->updates()->count()) }}</span>
@if($incident->message)
<p><small>{{ Str::words($incident->message, 5) }}</small></p>
@endif
Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use CachetHQ\Cachet\Settings\Cache;
use CachetHQ\Cachet\Settings\Repository;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Testing\TestCase;
use Laravel\BrowserKitTesting\TestCase;

/**
* This is the abstract test case class.
Expand Down

0 comments on commit 5eaba3c

Please sign in to comment.