mirror of
https://github.com/standardebooks/web.git
synced 2025-07-22 15:24:46 -04:00
Move enums into their own namespace
This commit is contained in:
parent
c3c588cc1b
commit
be5574eaec
45 changed files with 164 additions and 154 deletions
|
@ -24,12 +24,12 @@ try{
|
|||
|
||||
// Only approved reviewers can set the status to anything but unverified when uploading.
|
||||
// The submitter cannot review their own submissions unless they have special permission.
|
||||
if($artwork->Status !== ArtworkStatusType::Unverified && !$artwork->CanStatusBeChangedBy($GLOBALS['User'])){
|
||||
if($artwork->Status !== Enums\ArtworkStatusType::Unverified && !$artwork->CanStatusBeChangedBy($GLOBALS['User'])){
|
||||
throw new Exceptions\InvalidPermissionsException();
|
||||
}
|
||||
|
||||
// If the artwork is approved, set the reviewer
|
||||
if($artwork->Status !== ArtworkStatusType::Unverified){
|
||||
if($artwork->Status !== Enums\ArtworkStatusType::Unverified){
|
||||
$artwork->ReviewerUserId = $GLOBALS['User']->UserId;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ try{
|
|||
$artwork->SubmitterUserId = $originalArtwork->SubmitterUserId;
|
||||
$artwork->Status = $originalArtwork->Status; // Overwrite any value got from POST because we need permission to change the status
|
||||
|
||||
$newStatus = ArtworkStatusType::tryFrom(HttpInput::Str(POST, 'artwork-status') ?? '');
|
||||
$newStatus = Enums\ArtworkStatusType::tryFrom(HttpInput::Str(POST, 'artwork-status') ?? '');
|
||||
if($newStatus !== null){
|
||||
if($originalArtwork->Status != $newStatus && !$originalArtwork->CanStatusBeChangedBy($GLOBALS['User'])){
|
||||
throw new Exceptions\InvalidPermissionsException();
|
||||
|
@ -89,7 +89,7 @@ try{
|
|||
|
||||
// We can PATCH the status, the ebook www filesystem path, or both.
|
||||
if(isset($_POST['artwork-status'])){
|
||||
$newStatus = ArtworkStatusType::tryFrom(HttpInput::Str(POST, 'artwork-status') ?? '');
|
||||
$newStatus = Enums\ArtworkStatusType::tryFrom(HttpInput::Str(POST, 'artwork-status') ?? '');
|
||||
if($newStatus !== null){
|
||||
if($artwork->Status != $newStatus && !$artwork->CanStatusBeChangedBy($GLOBALS['User'])){
|
||||
throw new Exceptions\InvalidPermissionsException();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue