Fix empty wish title
This commit is contained in:
parent
5e3eee3ed0
commit
23b724bfdc
2 changed files with 12 additions and 2 deletions
|
@ -212,4 +212,14 @@ class Wish
|
|||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
$title = $this->title
|
||||
?: $this->description
|
||||
?: $this->url
|
||||
?: $this->id;
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use wishthis\{Page, Wish};
|
|||
$userIsAuthenticated = false;
|
||||
|
||||
$wish = new Wish($_GET['id'], false);
|
||||
$page = new Page(__FILE__, $wish->title);
|
||||
$page = new Page(__FILE__, $wish->getTitle());
|
||||
|
||||
if ('POST' === $_SERVER['REQUEST_METHOD'] && count($_POST) >= 0) {
|
||||
$wish_id = $_POST['wish_id'];
|
||||
|
@ -31,7 +31,7 @@ if ('POST' === $_SERVER['REQUEST_METHOD'] && count($_POST) >= 0) {
|
|||
WHERE `id` = ' . $wish_id . ';');
|
||||
|
||||
$wish = new Wish($_GET['id'], false);
|
||||
$page = new Page(__FILE__, $wish->title);
|
||||
$page = new Page(__FILE__, $wish->getTitle());
|
||||
$page->messages[] = Page::success('Wish successfully updated.', 'Success');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue