Merge pull request #1270 from ArthurHoaro/hotfix/sticky-warning

Fix a warning if links sticky status isn't set
This commit is contained in:
ArthurHoaro 2019-02-24 11:30:35 +01:00 committed by GitHub
commit c21dcc8199
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -252,7 +252,8 @@ private function check()
),
'private' => 0,
'created' => new DateTime(),
'tags' => 'opensource software'
'tags' => 'opensource software',
'sticky' => false,
);
$link['shorturl'] = link_small_hash($link['created'], $link['id']);
$this->links[1] = $link;
@ -265,6 +266,7 @@ private function check()
'private' => 1,
'created' => new DateTime('1 minute ago'),
'tags' => 'secretstuff',
'sticky' => false,
);
$link['shorturl'] = link_small_hash($link['created'], $link['id']);
$this->links[0] = $link;
@ -306,6 +308,8 @@ private function read()
$link['real_url'] = $link['url'];
$link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
// To be able to load links before running the update, and prepare the update
if (!isset($link['created'])) {
$link['id'] = $link['linkdate'];

View file

@ -1171,6 +1171,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
$link['thumbnail'] = $thumbnailer->get($url);
}
$link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
$pluginManager->executeHooks('save_link', $link);
$LINKSDB[$id] = $link;