mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 07:40:39 -04:00
Allow PATCHing of artwork ebook URL to empty string
This commit is contained in:
parent
69dc4580ed
commit
6ff60d8d96
1 changed files with 16 additions and 12 deletions
|
@ -110,24 +110,28 @@ try{
|
||||||
$exceptionRedirectUrl = $artwork->Url;
|
$exceptionRedirectUrl = $artwork->Url;
|
||||||
|
|
||||||
// We can PATCH the status, the ebook www filesystem path, or both.
|
// We can PATCH the status, the ebook www filesystem path, or both.
|
||||||
|
if(isset($_POST['artwork-status'])){
|
||||||
|
$newStatus = ArtworkStatus::tryFrom(HttpInput::Str(POST, 'artwork-status') ?? '');
|
||||||
|
if($newStatus !== null){
|
||||||
|
if($artwork->Status != $newStatus && !$artwork->CanStatusBeChangedBy($GLOBALS['User'])){
|
||||||
|
throw new Exceptions\InvalidPermissionsException();
|
||||||
|
}
|
||||||
|
|
||||||
$newStatus = ArtworkStatus::tryFrom(HttpInput::Str(POST, 'artwork-status') ?? '');
|
$artwork->ReviewerUserId = $GLOBALS['User']->UserId;
|
||||||
if($newStatus !== null){
|
}
|
||||||
if($artwork->Status != $newStatus && !$artwork->CanStatusBeChangedBy($GLOBALS['User'])){
|
|
||||||
|
$artwork->Status = $newStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_POST['artwork-ebook-url'])){
|
||||||
|
$newEbookUrl = HttpInput::Str(POST, 'artwork-ebook-url');
|
||||||
|
if($artwork->EbookUrl != $newEbookUrl && !$artwork->CanEbookUrlBeChangedBy($GLOBALS['User'])){
|
||||||
throw new Exceptions\InvalidPermissionsException();
|
throw new Exceptions\InvalidPermissionsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$artwork->ReviewerUserId = $GLOBALS['User']->UserId;
|
$artwork->EbookUrl = $newEbookUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newEbookUrl = HttpInput::Str(POST, 'artwork-ebook-url') ?? null;
|
|
||||||
if($artwork->EbookUrl != $newEbookUrl && !$artwork->CanEbookUrlBeChangedBy($GLOBALS['User'])){
|
|
||||||
throw new Exceptions\InvalidPermissionsException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$artwork->Status = $newStatus ?? $artwork->Status;
|
|
||||||
$artwork->EbookUrl = $newEbookUrl ?? $artwork->EbookUrl;
|
|
||||||
|
|
||||||
$artwork->Save();
|
$artwork->Save();
|
||||||
|
|
||||||
$_SESSION['artwork'] = $artwork;
|
$_SESSION['artwork'] = $artwork;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue