diff --git a/src/app/Domain.php b/src/app/Domain.php --- a/src/app/Domain.php +++ b/src/app/Domain.php @@ -250,6 +250,27 @@ throw new \Exception("Invalid domain status: {$status}"); } + if (!$this->isPublic()) { + if ($new_status & self::STATUS_CONFIRMED) { + if ($new_status & self::STATUS_VERIFIED) { + $new_status |= self::STATUS_ACTIVE; + $new_status ^= self::STATUS_NEW; + } else { + // if we have confirmed ownership of or management access to the domain, then + // we have also confirmed the domain exists in DNS. + $new_status |= self::STATUS_VERIFIED; + } + } + + if ($new_status & self::STATUS_DELETED) { + $new_status ^= self::STATUS_ACTIVE; + } + + if ($new_status & self::STATUS_SUSPENDED) { + $new_status ^= self::STATUS_ACTIVE; + } + } + $this->attributes['status'] = $new_status; } diff --git a/src/app/Observers/DomainObserver.php b/src/app/Observers/DomainObserver.php --- a/src/app/Observers/DomainObserver.php +++ b/src/app/Observers/DomainObserver.php @@ -26,7 +26,7 @@ $domain->namespace = \strtolower($domain->namespace); - $domain->status |= Domain::STATUS_NEW | Domain::STATUS_ACTIVE; + $domain->status |= Domain::STATUS_NEW; } /**