#4: Added settings to configure moderation for known/anonymous users
This commit is contained in:
parent
d1d77752b3
commit
67bf7086c0
@ -113,7 +113,8 @@ class ConfigHelper
|
|||||||
'hotlink_protection' => false,
|
'hotlink_protection' => false,
|
||||||
'items_per_page' => 12,
|
'items_per_page' => 12,
|
||||||
'items_per_page_admin' => 10,
|
'items_per_page_admin' => 10,
|
||||||
'photo_comments_require_login' => true,
|
'moderate_anonymous_users' => true,
|
||||||
|
'moderate_known_users' => true,
|
||||||
'photo_comments_thread_depth' => 3,
|
'photo_comments_thread_depth' => 3,
|
||||||
'public_statistics' => true,
|
'public_statistics' => true,
|
||||||
'recaptcha_enabled_registration' => false,
|
'recaptcha_enabled_registration' => false,
|
||||||
|
@ -236,7 +236,8 @@ class DefaultController extends Controller
|
|||||||
'allow_self_registration',
|
'allow_self_registration',
|
||||||
'enable_visitor_hits',
|
'enable_visitor_hits',
|
||||||
'hotlink_protection',
|
'hotlink_protection',
|
||||||
'photo_comments_require_login',
|
'moderate_anonymous_users',
|
||||||
|
'moderate_known_users',
|
||||||
'recaptcha_enabled_registration',
|
'recaptcha_enabled_registration',
|
||||||
'remove_copyright',
|
'remove_copyright',
|
||||||
'require_email_verification',
|
'require_email_verification',
|
||||||
|
@ -157,6 +157,20 @@ class PhotoCommentController extends Controller
|
|||||||
$isAutoApproved = true;
|
$isAutoApproved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto-approve the comment if settings allow
|
||||||
|
if ($user->isAnonymous() && !UserConfig::get('moderate_anonymous_users'))
|
||||||
|
{
|
||||||
|
$comment->approved_at = new \DateTime();
|
||||||
|
$comment->approved_user_id = null; // we don't have a user ID to set!
|
||||||
|
$isAutoApproved = true;
|
||||||
|
}
|
||||||
|
else if (!$user->isAnonymous() && !UserConfig::get('moderate_known_users'))
|
||||||
|
{
|
||||||
|
$comment->approved_at = new \DateTime();
|
||||||
|
$comment->approved_user_id = $user->id;
|
||||||
|
$isAutoApproved = true;
|
||||||
|
}
|
||||||
|
|
||||||
$comment->save();
|
$comment->save();
|
||||||
|
|
||||||
if ($isAutoApproved)
|
if ($isAutoApproved)
|
||||||
|
@ -48,20 +48,12 @@ class PhotoComment extends Model
|
|||||||
|
|
||||||
public function isApproved()
|
public function isApproved()
|
||||||
{
|
{
|
||||||
return (
|
return (!is_null($this->approved_at) && is_null($this->rejected_at));
|
||||||
!is_null($this->approved_user_id) &&
|
|
||||||
!is_null($this->approved_at) &&
|
|
||||||
is_null($this->rejected_user_id) &&
|
|
||||||
is_null($this->rejected_at)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isModerated()
|
public function isModerated()
|
||||||
{
|
{
|
||||||
return (
|
return (!is_null($this->approved_at) || !is_null($this->rejected_at));
|
||||||
(!is_null($this->approved_user_id) && !is_null($this->approved_at)) ||
|
|
||||||
(!is_null($this->rejected_user_id) && !is_null($this->rejected_at))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parent()
|
public function parent()
|
||||||
|
@ -222,6 +222,7 @@ return [
|
|||||||
'analytics_enable_visitor_hits' => 'Enable built-in visitor hit tracking',
|
'analytics_enable_visitor_hits' => 'Enable built-in visitor hit tracking',
|
||||||
'analytics_enable_visitor_hits_description' => 'Visitor hits to the public gallery will be recorded in the Blue Twilight database, allowing for analysis such as the most popular album/photo.',
|
'analytics_enable_visitor_hits_description' => 'Visitor hits to the public gallery will be recorded in the Blue Twilight database, allowing for analysis such as the most popular album/photo.',
|
||||||
'analytics_tab' => 'Analytics',
|
'analytics_tab' => 'Analytics',
|
||||||
|
'comments_moderation' => 'Moderation',
|
||||||
'comments_tab' => 'Comments',
|
'comments_tab' => 'Comments',
|
||||||
'permissions_cache' => 'Permissions Cache',
|
'permissions_cache' => 'Permissions Cache',
|
||||||
'permissions_cache_intro' => 'Blue Twilight maintains the permissions each user has to albums in the database. If you feel these aren\'t correct based on what\'s configured, you can rebuild the cache by clicking the button below.',
|
'permissions_cache_intro' => 'Blue Twilight maintains the permissions each user has to albums in the database. If you feel these aren\'t correct based on what\'s configured, you can rebuild the cache by clicking the button below.',
|
||||||
|
@ -61,6 +61,10 @@ return [
|
|||||||
'settings_photo_comments_require_login_help' => 'If this option is enabled, users must login before they can post comments.',
|
'settings_photo_comments_require_login_help' => 'If this option is enabled, users must login before they can post comments.',
|
||||||
'settings_hotlink_protection' => 'Prevent hot-linking to images',
|
'settings_hotlink_protection' => 'Prevent hot-linking to images',
|
||||||
'settings_hotlink_protection_help' => 'With this option enabled, direct linking to images is not allowed. Photos can only be viewed through Blue Twilight.',
|
'settings_hotlink_protection_help' => 'With this option enabled, direct linking to images is not allowed. Photos can only be viewed through Blue Twilight.',
|
||||||
|
'settings_moderate_anonymous_users' => 'Moderate comments from unknown users',
|
||||||
|
'settings_moderate_anonymous_users_help' => 'If this option is enabled, comments posted by unknown users must be moderated before being displayed.',
|
||||||
|
'settings_moderate_known_users' => 'Moderate comments from logged-in users',
|
||||||
|
'settings_moderate_known_users_help' => 'If this option is enabled, comments posted by logged-in users must be moderated before being displayed.',
|
||||||
'settings_restrict_originals_download' => 'Restrict access to original images',
|
'settings_restrict_originals_download' => 'Restrict access to original images',
|
||||||
'settings_restrict_originals_download_help' => 'With this option enabled, only the photo\'s owner can download the original high-resolution images.',
|
'settings_restrict_originals_download_help' => 'With this option enabled, only the photo\'s owner can download the original high-resolution images.',
|
||||||
'settings_social_facebook_app_id' => 'Facebook App ID:',
|
'settings_social_facebook_app_id' => 'Facebook App ID:',
|
||||||
|
@ -496,14 +496,6 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-check mt-3">
|
|
||||||
<input type="checkbox" class="form-check-input" id="photo-comments-require-login" name="photo_comments_require_login" @if (old('photo_comments_require_login', UserConfig::get('photo_comments_require_login')))checked="checked"@endif>
|
|
||||||
<label class="form-check-label" for="photo-comments-require-login">
|
|
||||||
<strong>@lang('forms.settings_photo_comments_require_login')</strong><br/>
|
|
||||||
@lang('forms.settings_photo_comments_require_login_help')
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group mt-3">
|
<div class="form-group mt-3">
|
||||||
<label class="form-control-label" for="photo-comments-thread-depth">@lang('forms.settings_photo_comments_thread_depth')</label>
|
<label class="form-control-label" for="photo-comments-thread-depth">@lang('forms.settings_photo_comments_thread_depth')</label>
|
||||||
<input type="text" class="form-control{{ $errors->has('photo_comments_thread_depth') ? ' is-invalid' : '' }}" id="photo-comments-thread-depth" name="photo_comments_thread_depth" value="{{ old('photo_comments_thread_depth', $config['photo_comments_thread_depth']) }}" style="max-width: 100px;">
|
<input type="text" class="form-control{{ $errors->has('photo_comments_thread_depth') ? ' is-invalid' : '' }}" id="photo-comments-thread-depth" name="photo_comments_thread_depth" value="{{ old('photo_comments_thread_depth', $config['photo_comments_thread_depth']) }}" style="max-width: 100px;">
|
||||||
@ -515,6 +507,29 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
<fieldset>
|
||||||
|
<legend class="mb-3">
|
||||||
|
@lang('admin.settings.comments_moderation')
|
||||||
|
</legend>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" id="moderate-anonymous-users" name="moderate_anonymous_users" @if (old('moderate_anonymous_users', UserConfig::get('moderate_anonymous_users')))checked="checked"@endif>
|
||||||
|
<label class="form-check-label" for="moderate-anonymous-users">
|
||||||
|
<strong>@lang('forms.settings_moderate_anonymous_users')</strong><br/>
|
||||||
|
@lang('forms.settings_moderate_anonymous_users_help')
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check mt-3">
|
||||||
|
<input type="checkbox" class="form-check-input" id="moderate-known-users" name="moderate_known_users" @if (old('moderate_known_users', UserConfig::get('moderate_known_users')))checked="checked"@endif>
|
||||||
|
<label class="form-check-label" for="moderate-known-users">
|
||||||
|
<strong>@lang('forms.settings_moderate_known_users')</strong><br/>
|
||||||
|
@lang('forms.settings_moderate_known_users_help')
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user