Adjust watermark permissions and transparency
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { isBrandingAllowed, isWatermarkAllowed } from '../events';
|
||||
import { isBrandingAllowed, isWatermarkAllowed, isWatermarkRemovalAllowed } from '../events';
|
||||
|
||||
describe('event branding access helpers', () => {
|
||||
it('respects package-level disallow', () => {
|
||||
@@ -25,5 +25,14 @@ describe('event branding access helpers', () => {
|
||||
it('defaults to allow when nothing is set', () => {
|
||||
expect(isBrandingAllowed({} as any)).toBe(true);
|
||||
expect(isWatermarkAllowed({} as any)).toBe(true);
|
||||
expect(isWatermarkRemovalAllowed({} as any)).toBe(false);
|
||||
});
|
||||
|
||||
it('uses removal flag from settings', () => {
|
||||
const event = {
|
||||
settings: { watermark_removal_allowed: true },
|
||||
};
|
||||
|
||||
expect(isWatermarkRemovalAllowed(event as any)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -116,6 +116,15 @@ export function isWatermarkAllowed(event?: TenantEvent | null): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function isWatermarkRemovalAllowed(event?: TenantEvent | null): boolean {
|
||||
if (!event) return false;
|
||||
const settings = (event.settings ?? {}) as Record<string, unknown>;
|
||||
if (typeof settings.watermark_removal_allowed === 'boolean') {
|
||||
return settings.watermark_removal_allowed;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function formatEventStatusLabel(
|
||||
status: TenantEvent['status'] | null,
|
||||
t: (key: string, options?: Record<string, unknown>) => string,
|
||||
|
||||
Reference in New Issue
Block a user