use Friendica\Content\BoundariesPager;
use Friendica\Content\Feature;
use Friendica\Content\Nav;
+use Friendica\Content\Text\HTML;
use Friendica\Content\Widget\TrendingTags;
use Friendica\Core\ACL;
use Friendica\Core\Renderer;
use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Network\HTTPException;
+use Friendica\Util\DateTimeFormat;
class Community extends BaseModule
{
public static function content(array $parameters = [])
{
+ // Rawmode is used for fetching new content at the end of the page
+ $rawmode = (isset($_GET['mode']) AND ($_GET['mode'] == 'raw'));
+
self::parseRequest($parameters);
$tabs = [];
];
}
- $tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
- $o = Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
+ if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll') && ($_GET['mode'] ?? '') != 'minimal') {
+ $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
+ $o = Renderer::replaceMacros($tpl, ['$reload_uri' => DI::args()->getQueryString()]);
+ } else {
+ $o = '';
+ }
+
+ if (!$rawmode) {
+ $tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
+ $o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
+ }
Nav::setSelected('community');
self::$itemsPerPage
);
- $o .= $pager->renderMinimal(count($items));
-
- DI::page()['aside'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/community_accounts.tpl'), [
- '$title' => DI::l10n()->t('Accounts'),
- '$content' => self::$content,
- '$accounttype' => ($parameters['accounttype'] ?? ''),
- '$all' => DI::l10n()->t('All'),
- '$person' => DI::l10n()->t('Persons'),
- '$organisation' => DI::l10n()->t('Organisations'),
- '$news' => DI::l10n()->t('News'),
- '$community' => DI::l10n()->t('Forums'),
- ]);
+ if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
+ $o .= HTML::scrollLoader();
+ } else {
+ $o .= $pager->renderMinimal(count($items));
+ }
+
+ if (!$rawmode) {
+ DI::page()['aside'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/community_accounts.tpl'), [
+ '$title' => DI::l10n()->t('Accounts'),
+ '$content' => self::$content,
+ '$accounttype' => ($parameters['accounttype'] ?? ''),
+ '$all' => DI::l10n()->t('All'),
+ '$person' => DI::l10n()->t('Persons'),
+ '$organisation' => DI::l10n()->t('Organisations'),
+ '$news' => DI::l10n()->t('News'),
+ '$community' => DI::l10n()->t('Forums'),
+ ]);
+ }
- if (local_user() && DI::config()->get('system', 'community_no_sharer')) {
+ if (!$rawmode && local_user() && DI::config()->get('system', 'community_no_sharer')) {
$path = self::$content . ($parameters['accounttype'] ? '/' . $parameters['accounttype'] : '');
$query_parameters = [];
if (!empty($_GET['max_id'])) {
$query_parameters['max_id'] = $_GET['max_id'];
}
+ if (!empty($_GET['last_commented'])) {
+ $query_parameters['max_id'] = DateTimeFormat::utc($_GET['last_commented']);
+ }
$path_all = $path . (!empty($query_parameters) ? '?' . http_build_query($query_parameters) : '');
$path_no_sharer = $path . '?' . http_build_query(array_merge($query_parameters, ['no_sharer' => true]));
]);
}
- if (Feature::isEnabled(local_user(), 'trending_tags')) {
+ if (!$rawmode && Feature::isEnabled(local_user(), 'trending_tags')) {
DI::page()['aside'] .= TrendingTags::getHTML(self::$content);
}
self::$since_id = $_GET['since_id'] ?? null;
self::$max_id = $_GET['max_id'] ?? null;
+ self::$max_id = $_GET['last_commented'] ?? self::$max_id;
}
/**