Adjust watermark permissions and transparency
This commit is contained in:
@@ -20,6 +20,7 @@ use App\Models\User;
|
||||
use App\Services\EventJoinTokenService;
|
||||
use App\Support\ApiError;
|
||||
use App\Support\TenantMemberPermissions;
|
||||
use App\Support\WatermarkConfigResolver;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||
@@ -414,6 +415,7 @@ class EventController extends Controller
|
||||
$package = $event->eventPackage?->package;
|
||||
$brandingAllowed = optional($package)->branding_allowed !== false;
|
||||
$watermarkAllowed = optional($package)->watermark_allowed !== false;
|
||||
$watermarkRemovalAllowed = WatermarkConfigResolver::determineRemovalAllowed($event);
|
||||
|
||||
if (isset($validated['settings']) && is_array($validated['settings'])) {
|
||||
$validated['settings'] = array_merge($event->settings ?? [], $validated['settings']);
|
||||
@@ -423,6 +425,7 @@ class EventController extends Controller
|
||||
|
||||
$validated['settings']['branding_allowed'] = $brandingAllowed;
|
||||
$validated['settings']['watermark_allowed'] = $watermarkAllowed;
|
||||
$validated['settings']['watermark_removal_allowed'] = $watermarkRemovalAllowed;
|
||||
|
||||
$settings = $validated['settings'];
|
||||
$branding = Arr::get($settings, 'branding', []);
|
||||
@@ -435,20 +438,19 @@ class EventController extends Controller
|
||||
|
||||
if (is_array($watermark)) {
|
||||
$mode = $watermark['mode'] ?? 'base';
|
||||
$policy = $watermarkAllowed ? 'basic' : 'none';
|
||||
|
||||
if (! $watermarkAllowed) {
|
||||
$mode = 'off';
|
||||
$mode = 'base';
|
||||
} elseif (! $brandingAllowed) {
|
||||
$mode = 'base';
|
||||
} elseif ($mode === 'off' && $policy === 'basic') {
|
||||
} elseif ($mode === 'off' && ! $watermarkRemovalAllowed) {
|
||||
$mode = 'base';
|
||||
}
|
||||
|
||||
$assetPath = $watermark['asset'] ?? null;
|
||||
$assetDataUrl = $watermark['asset_data_url'] ?? null;
|
||||
|
||||
if (! $watermarkAllowed) {
|
||||
if (! $watermarkAllowed || $mode === 'off') {
|
||||
$assetPath = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user