diff --git a/app/Http/Controllers/Dashboard/SettingsController.php b/app/Http/Controllers/Dashboard/SettingsController.php index f128e22711e1..28e81efdf235 100644 --- a/app/Http/Controllers/Dashboard/SettingsController.php +++ b/app/Http/Controllers/Dashboard/SettingsController.php @@ -248,17 +248,20 @@ public function showCreditsView() $credits = app(Credits::class)->latest(); - $backers = $credits['backers']; - $contributors = $credits['contributors']; + if ($credits) { + $backers = $credits['backers']; + $contributors = $credits['contributors']; - shuffle($backers); - shuffle($contributors); + shuffle($backers); + shuffle($contributors); + } return View::make('dashboard.settings.credits') ->withPageTitle(trans('dashboard.settings.credits.credits').' - '.trans('dashboard.dashboard')) - ->withBackers($backers) - ->withContributors($contributors) - ->withSubMenu($this->subMenu); + ->withBackers(($credits) ? $backers : false) + ->withContributors(($credits) ? $contributors : false) + ->withSubMenu($this->subMenu) + ->withErrors((!$credits) ? trans('dashboard.settings.credits.unable-to-load') : null); } /** diff --git a/app/Integrations/Core/Credits.php b/app/Integrations/Core/Credits.php index e821c3b6f29b..3df1671ddb1f 100644 --- a/app/Integrations/Core/Credits.php +++ b/app/Integrations/Core/Credits.php @@ -77,6 +77,8 @@ public function latest() try { return json_decode((new Client())->get($this->url, [ 'headers' => ['Accept' => 'application/json', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/'.constant('CACHET_VERSION') : 'cachet'], + 'timeout' => 5, + 'connect_timeout' => 5, ])->getBody(), true); } catch (Exception $e) { return self::FAILED; diff --git a/resources/lang/en/dashboard.php b/resources/lang/en/dashboard.php index 7dc9af669deb..2af0d6073aea 100644 --- a/resources/lang/en/dashboard.php +++ b/resources/lang/en/dashboard.php @@ -255,6 +255,7 @@ 'backers-title' => 'Backers & Sponsors', 'backers' => 'If you\'d like to support future development, check out the Cachet Patreon campaign.', 'thank-you' => 'Thank you to each and every one of the :count contributors.', + 'unable-to-load'=> 'Unable to load details about contributors and sponsors.' ], ], diff --git a/resources/views/dashboard/settings/credits.blade.php b/resources/views/dashboard/settings/credits.blade.php index 927f38259a9e..a990dce49ce0 100644 --- a/resources/views/dashboard/settings/credits.blade.php +++ b/resources/views/dashboard/settings/credits.blade.php @@ -11,11 +11,13 @@
+ @include('partials.errors')

Cachet

{!! trans('dashboard.settings.credits.license') !!}


+ @if($contributors)

{{ trans('dashboard.settings.credits.contributors') }}

@@ -30,6 +32,7 @@ @endforeach + @endif