Subscribers don't need to be enabled to send emails. Closes #1994
This commit is contained in:
@@ -86,5 +86,6 @@ class AppComposer
|
||||
$view->withFontSubset($this->config->get('langs.'.$this->config->get('app.locale').'.subset', 'latin'));
|
||||
$view->withOnlyDisruptedDays($this->config->get('setting.only_disrupted_days'));
|
||||
$view->withDashboardLink($this->config->get('setting.dashboard_login_link'));
|
||||
$view->withEnableSubscribers($this->config->get('setting.enable_subscribers'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
namespace CachetHQ\Cachet\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
@@ -22,6 +23,25 @@ use Illuminate\Http\Request;
|
||||
*/
|
||||
class SubscribersConfigured
|
||||
{
|
||||
/**
|
||||
* The config repository instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Config\Repository
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Creates a subscribers configured middleware instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Repository $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
@@ -32,7 +52,7 @@ class SubscribersConfigured
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if (!subscribers_enabled()) {
|
||||
if (!$this->config->get('setting.enable_subscribers')) {
|
||||
return cachet_redirect('status-page');
|
||||
}
|
||||
|
||||
|
||||
@@ -51,22 +51,6 @@ if (!function_exists('formatted_date')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('subscribers_enabled')) {
|
||||
/**
|
||||
* Is the subscriber functionality enabled and configured.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function subscribers_enabled()
|
||||
{
|
||||
$isEnabled = Config::get('setting.enable_subscribers', false);
|
||||
$mailAddress = Config::get('mail.from.address', false);
|
||||
$mailFrom = Config::get('mail.from.name', false);
|
||||
|
||||
return $isEnabled && $mailAddress && $mailFrom;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('color_darken')) {
|
||||
/**
|
||||
* Darken a color.
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
<input type="text" name="occurred_at" class="form-control" rel="datepicker-custom" data-date-format="YYYY-MM-DD HH:mm" placeholder="{{ trans('forms.optional') }}">
|
||||
</div>
|
||||
<input type="hidden" name="notify" value="0">
|
||||
@if(subscribers_enabled())
|
||||
@if($enable_subscribers)
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="notify" value="1" checked="{{ Binput::old('notify', 'checked') }}">
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<span class="uppercase">
|
||||
<i class="ion ion-ios-email-outline"></i> {{ trans('dashboard.subscribers.subscribers') }}
|
||||
</span>
|
||||
@if($current_user->isAdmin && subscribers_enabled())
|
||||
@if($current_user->isAdmin && $enable_subscribers)
|
||||
<a class="btn btn-md btn-success pull-right" href="{{ cachet_route('dashboard.subscribers.create') }}">
|
||||
{{ trans('dashboard.subscribers.add.title') }}
|
||||
</a>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<li>
|
||||
<a class="btn btn-link" href="{{ cachet_route('feed.atom') }}">{{ trans('cachet.atom-feed') }}</a>
|
||||
</li>
|
||||
@if(subscribers_enabled())
|
||||
@if($enable_subscribers)
|
||||
<li>
|
||||
<a class="btn btn-success btn-outline" href="{{ cachet_route('subscribe') }}">{{ trans('cachet.subscriber.button') }}</a>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user