From 016c99935cfbd4d320f15037cf00a53589a0615d Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 16 Jun 2020 06:49:53 +0000 Subject: [PATCH] Different comment limits for single view --- include/conversation.php | 6 +++++- src/Module/Admin/Site.php | 3 +++ view/templates/admin/site.tpl | 1 + view/theme/frio/templates/admin/site.tpl | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/conversation.php b/include/conversation.php index e623c9320b..6e024fe20f 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -760,7 +760,11 @@ function conversation_fetch_comments($thread_items, $pinned) { * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function conversation_add_children(array $parents, $block_authors, $order, $uid) { - $max_comments = DI::config()->get('system', 'max_comments', 100); + if (count($parents) > 1) { + $max_comments = DI::config()->get('system', 'max_comments', 100); + } else { + $max_comments = DI::config()->get('system', 'max_display_comments', 1000); + } $params = ['order' => ['uid', 'commented' => true]]; diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index 8dcddb188e..124b21c28a 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -199,6 +199,7 @@ class Site extends BaseAdmin $itemcache = (!empty($_POST['itemcache']) ? Strings::escapeTags(trim($_POST['itemcache'])) : ''); $itemcache_duration = (!empty($_POST['itemcache_duration']) ? intval($_POST['itemcache_duration']) : 0); $max_comments = (!empty($_POST['max_comments']) ? intval($_POST['max_comments']) : 0); + $max_display_comments = (!empty($_POST['max_display_comments']) ? intval($_POST['max_display_comments']) : 0); $temppath = (!empty($_POST['temppath']) ? Strings::escapeTags(trim($_POST['temppath'])) : ''); $singleuser = (!empty($_POST['singleuser']) ? Strings::escapeTags(trim($_POST['singleuser'])) : ''); $proxy_disabled = !empty($_POST['proxy_disabled']); @@ -407,6 +408,7 @@ class Site extends BaseAdmin DI::config()->set('system', 'itemcache', $itemcache); DI::config()->set('system', 'itemcache_duration', $itemcache_duration); DI::config()->set('system', 'max_comments', $max_comments); + DI::config()->set('system', 'max_display_comments', $max_display_comments); if ($temppath != '') { $temppath = BasePath::getRealPath($temppath); @@ -695,6 +697,7 @@ class Site extends BaseAdmin '$itemcache' => ['itemcache', DI::l10n()->t('Path to item cache'), DI::config()->get('system', 'itemcache'), DI::l10n()->t('The item caches buffers generated bbcode and external images.')], '$itemcache_duration' => ['itemcache_duration', DI::l10n()->t('Cache duration in seconds'), DI::config()->get('system', 'itemcache_duration'), DI::l10n()->t('How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.')], '$max_comments' => ['max_comments', DI::l10n()->t('Maximum numbers of comments per post'), DI::config()->get('system', 'max_comments'), DI::l10n()->t('How much comments should be shown for each post? Default value is 100.')], + '$max_display_comments' => ['max_display_comments', DI::l10n()->t('Maximum numbers of comments per post on the display page'), DI::config()->get('system', 'max_display_comments'), DI::l10n()->t('How much comments should be shown on the single view for each post? Default value is 1000.')], '$temppath' => ['temppath', DI::l10n()->t('Temp path'), DI::config()->get('system', 'temppath'), DI::l10n()->t('If you have a restricted system where the webserver can\'t access the system temp path, enter another path here.')], '$proxy_disabled' => ['proxy_disabled', DI::l10n()->t('Disable picture proxy'), DI::config()->get('system', 'proxy_disabled'), DI::l10n()->t('The picture proxy increases performance and privacy. It shouldn\'t be used on systems with very low bandwidth.')], '$only_tag_search' => ['only_tag_search', DI::l10n()->t('Only search in tags'), DI::config()->get('system', 'only_tag_search'), DI::l10n()->t('On large systems the text search can slow down the system extremely.')], diff --git a/view/templates/admin/site.tpl b/view/templates/admin/site.tpl index cb948aabe6..dc76db31c5 100644 --- a/view/templates/admin/site.tpl +++ b/view/templates/admin/site.tpl @@ -110,6 +110,7 @@ {{include file="field_input.tpl" field=$itemcache}} {{include file="field_input.tpl" field=$itemcache_duration}} {{include file="field_input.tpl" field=$max_comments}} + {{include file="field_input.tpl" field=$max_display_comments}} {{include file="field_checkbox.tpl" field=$proxy_disabled}} {{include file="field_checkbox.tpl" field=$dbclean}} {{include file="field_input.tpl" field=$dbclean_expire_days}} diff --git a/view/theme/frio/templates/admin/site.tpl b/view/theme/frio/templates/admin/site.tpl index 652fe91c33..5c9cfb1981 100644 --- a/view/theme/frio/templates/admin/site.tpl +++ b/view/theme/frio/templates/admin/site.tpl @@ -249,6 +249,7 @@ {{include file="field_input.tpl" field=$itemcache}} {{include file="field_input.tpl" field=$itemcache_duration}} {{include file="field_input.tpl" field=$max_comments}} + {{include file="field_input.tpl" field=$max_display_comments}} {{include file="field_checkbox.tpl" field=$proxy_disabled}} {{include file="field_checkbox.tpl" field=$dbclean}} {{include file="field_input.tpl" field=$dbclean_expire_days}}