Adjust watermark permissions and transparency
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-19 13:45:43 +01:00
parent fbff2afa3e
commit d4ab9a3a20
15 changed files with 325 additions and 54 deletions

View File

@@ -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);
});
});

View File

@@ -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,