Merge pull request #11618 from annando/forced-display-update

Fix forced updates on the display page
This commit is contained in:
Hypolite Petovan 2022-06-07 13:55:15 -04:00 committed by GitHub
commit 6b0b8848a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View File

@ -160,15 +160,19 @@ function display_content(App $a, $update = false, $update_uid = 0)
} }
$parent_uri_id = $item['parent-uri-id']; $parent_uri_id = $item['parent-uri-id'];
} }
$browser_update = intval(DI::pConfig()->get($update_uid, 'system', 'update_interval')); if (empty($_REQUEST['force'])) {
if (!empty($browser_update)) { $browser_update = intval(DI::pConfig()->get($update_uid, 'system', 'update_interval'));
$update_date = date(DateTimeFormat::MYSQL, time() - ($browser_update / 500)); if (!empty($browser_update)) {
if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parent_uri_id, 0, $update_uid, $update_date])) { $update_date = date(DateTimeFormat::MYSQL, time() - ($browser_update / 500));
Logger::debug('No updated content', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]); if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parent_uri_id, 0, $update_uid, $update_date])) {
return ''; Logger::debug('No updated content', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
} else { return '';
Logger::debug('Updated content found', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]); } 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 { } else {
$uri_id = ((DI::args()->getArgc() > 2) ? DI::args()->getArgv()[2] : 0); $uri_id = ((DI::args()->getArgc() > 2) ? DI::args()->getArgv()[2] : 0);

View File

@ -233,7 +233,7 @@ return [
'/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]], '/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]],
'/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo '/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
'/instance/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]], '/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' => [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+}' => [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]], '/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/{id:\d+}' => [Module\Api\Mastodon\Notifications::class, [R::GET ]],
'/notifications/clear' => [Module\Api\Mastodon\Notifications\Clear::class, [ R::POST]], '/notifications/clear' => [Module\Api\Mastodon\Notifications\Clear::class, [ R::POST]],
'/notifications/{id:\d+}/dismiss' => [Module\Api\Mastodon\Notifications\Dismiss::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 '/polls/{id:\d+}/votes' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/preferences' => [Module\Api\Mastodon\Preferences::class, [R::GET ]], '/preferences' => [Module\Api\Mastodon\Preferences::class, [R::GET ]],
'/push/subscription' => [Module\Api\Mastodon\PushSubscription::class, [R::GET, R::POST, R::PUT, R::DELETE]], '/push/subscription' => [Module\Api\Mastodon\PushSubscription::class, [R::GET, R::POST, R::PUT, R::DELETE]],