Skip to content

Commit

Permalink
Moved gthe settings for remote loading to the branding section
Browse files Browse the repository at this point in the history
Signed-off-by: snipe <[email protected]>
  • Loading branch information
snipe committed Jul 4, 2024
1 parent 36ae162 commit 3f20e29
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ public function postSettings(Request $request)
}

$setting->default_eula_text = $request->input('default_eula_text');
$setting->load_remote = $request->input('load_remote', 0);
$setting->thumbnail_max_h = $request->input('thumbnail_max_h');
$setting->privacy_policy_link = $request->input('privacy_policy_link');
$setting->depreciation_method = $request->input('depreciation_method');
Expand Down Expand Up @@ -411,6 +410,7 @@ public function postBranding(ImageUploadRequest $request)
$setting->allow_user_skin = $request->input('allow_user_skin', '0');
$setting->show_url_in_emails = $request->input('show_url_in_emails', '0');
$setting->logo_print_assets = $request->input('logo_print_assets', '0');
$setting->load_remote = $request->input('load_remote', 0);

// Only allow the site name, images, and CSS to be changed if lock_passwords is false
// Because public demos make people act like dicks
Expand Down
8 changes: 4 additions & 4 deletions app/Presenters/UserPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ public function gravatar()
return Storage::disk('public')->url('avatars/'.e($this->avatar));
}

// If there is a default avatar
if (Setting::getSettings()->default_avatar!= '') {
return Storage::disk('public')->url('avatars/'.e(Setting::getSettings()->default_avatar));
}

// Fall back to Gravatar if the settings allow loading remote scripts
if (Setting::getSettings()->load_remote == '1') {
Expand All @@ -460,10 +464,6 @@ public function gravatar()
}
}

// If there is a default avatar
if (Setting::getSettings()->default_avatar!= '') {
return Storage::disk('public')->url('avatars/'.e(Setting::getSettings()->default_avatar));
}

return false;
}
Expand Down
19 changes: 19 additions & 0 deletions resources/views/settings/branding.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,25 @@
"helpBlock" => trans('general.image_filetypes_help', ['size' => Helper::file_upload_max_size_readable()]),
])

<!-- Load gravatar -->
<div class="form-group {{ $errors->has('load_remote') ? 'error' : '' }}">
<div class="col-md-3">
<strong>{{ trans('admin/settings/general.load_remote') }}</strong>
</div>
<div class="col-md-9">
<label class="form-control">
{{ Form::checkbox('load_remote', '1', old('load_remote', $setting->load_remote)) }}
{{ trans('general.yes') }}
{!! $errors->first('load_remote', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</label>

<p class="help-block">
{{ trans('admin/settings/general.load_remote_help_text') }}
</p>

</div>
</div>


<!-- Include logo in print assets -->
<div class="form-group">
Expand Down
18 changes: 0 additions & 18 deletions resources/views/settings/general.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,24 +144,6 @@
</div>
</div>

<!-- Load gravatar -->
<div class="form-group {{ $errors->has('load_remote') ? 'error' : '' }}">
<div class="col-md-3">
<strong>{{ trans('admin/settings/general.load_remote') }}</strong>
</div>
<div class="col-md-9">
<label class="form-control">
{{ Form::checkbox('load_remote', '1', old('load_remote', $setting->load_remote)) }}
{{ trans('general.yes') }}
{!! $errors->first('load_remote', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</label>

<p class="help-block">
{{ trans('admin/settings/general.load_remote_help_text') }}
</p>

</div>
</div>

<!-- unique serial -->
<div class="form-group">
Expand Down

0 comments on commit 3f20e29

Please sign in to comment.