fix: viewing shared wishlist by hash
This commit is contained in:
parent
e7893e8de2
commit
56993052b4
3 changed files with 3 additions and 6 deletions
|
@ -148,12 +148,9 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
}
|
}
|
||||||
} elseif ($getWishlistFromHash) {
|
} elseif ($getWishlistFromHash) {
|
||||||
/**
|
|
||||||
* Get wishlist by hash
|
|
||||||
*/
|
|
||||||
$wishlist = Wishlist::getFromHash($_GET['wishlist_hash']);
|
$wishlist = Wishlist::getFromHash($_GET['wishlist_hash']);
|
||||||
|
|
||||||
if ($wishlist->exists) {
|
if ($wishlist instanceof Wishlist) {
|
||||||
$response['results'] = $wishlist;
|
$response['results'] = $wishlist;
|
||||||
} else {
|
} else {
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Wishlist
|
||||||
return $wishlist;
|
return $wishlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromHash(string $hash): self
|
public static function getFromHash(string $hash): self|false
|
||||||
{
|
{
|
||||||
global $database;
|
global $database;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ $page->scripts['wish'] = 'src/assets/js/parts/wish.js';
|
||||||
$page->scripts['wishlist-filter-priority'] = 'src/assets/js/parts/wishlist-filter-priority.js';
|
$page->scripts['wishlist-filter-priority'] = 'src/assets/js/parts/wishlist-filter-priority.js';
|
||||||
$page->scripts['wishlists'] = 'src/assets/js/parts/wishlists.js';
|
$page->scripts['wishlists'] = 'src/assets/js/parts/wishlists.js';
|
||||||
|
|
||||||
if (!$wishlist->exists) {
|
if (false === $wishlist) {
|
||||||
$page->errorDocument(404, $wishlist);
|
$page->errorDocument(404, $wishlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue