From d665b78ea82de494aaed81d0b352535f7e4098ea Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 7 Jun 2022 17:34:19 +0000 Subject: [PATCH] Fix forced updates on the display page --- mod/display.php | 22 +++++++++++++--------- static/routes.config.php | 4 ++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/mod/display.php b/mod/display.php index bc667dd5e1..cc594d7881 100644 --- a/mod/display.php +++ b/mod/display.php @@ -160,15 +160,19 @@ function display_content(App $a, $update = false, $update_uid = 0) } $parent_uri_id = $item['parent-uri-id']; } - $browser_update = intval(DI::pConfig()->get($update_uid, 'system', 'update_interval')); - if (!empty($browser_update)) { - $update_date = date(DateTimeFormat::MYSQL, time() - ($browser_update / 500)); - if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parent_uri_id, 0, $update_uid, $update_date])) { - Logger::debug('No updated content', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]); - return ''; - } else { - Logger::debug('Updated content found', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]); - } + if (empty($_REQUEST['force'])) { + $browser_update = intval(DI::pConfig()->get($update_uid, 'system', 'update_interval')); + if (!empty($browser_update)) { + $update_date = date(DateTimeFormat::MYSQL, time() - ($browser_update / 500)); + if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parent_uri_id, 0, $update_uid, $update_date])) { + Logger::debug('No updated content', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]); + return ''; + } else { + Logger::debug('Updated content found', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]); + } + } + } else { + Logger::debug('Forced content update', ['uri-id' => $uri_id, 'uid' => $update_uid]); } } else { $uri_id = ((DI::args()->getArgc() > 2) ? DI::args()->getArgv()[2] : 0); diff --git a/static/routes.config.php b/static/routes.config.php index 4c6f5b6bb4..72964d2308 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -233,7 +233,7 @@ return [ '/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]], '/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo '/instance/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]], - '/instance/rules' => [Module\Api\Mastodon\Instance\Rules::class, [R::GET ]], // not supported + '/instance/rules' => [Module\Api\Mastodon\Instance\Rules::class, [R::GET ]], '/lists' => [Module\Api\Mastodon\Lists::class, [R::GET, R::POST]], '/lists/{id:\d+}' => [Module\Api\Mastodon\Lists::class, [R::GET, R::PUT, R::DELETE]], '/lists/{id:\d+}/accounts' => [Module\Api\Mastodon\Lists\Accounts::class, [R::GET, R::POST, R::DELETE]], @@ -244,7 +244,7 @@ return [ '/notifications/{id:\d+}' => [Module\Api\Mastodon\Notifications::class, [R::GET ]], '/notifications/clear' => [Module\Api\Mastodon\Notifications\Clear::class, [ R::POST]], '/notifications/{id:\d+}/dismiss' => [Module\Api\Mastodon\Notifications\Dismiss::class, [ R::POST]], - '/polls/{id:\d+}' => [Module\Api\Mastodon\Polls::class, [R::GET ]], // not supported + '/polls/{id:\d+}' => [Module\Api\Mastodon\Polls::class, [R::GET ]], '/polls/{id:\d+}/votes' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported '/preferences' => [Module\Api\Mastodon\Preferences::class, [R::GET ]], '/push/subscription' => [Module\Api\Mastodon\PushSubscription::class, [R::GET, R::POST, R::PUT, R::DELETE]],