feat(gallery): publish notifies assigned customer accounts via the account email

Publishing a gallery with no inline customer_email but assigned customer
account(s) previously sent nothing (the dialog said "no notification"). Now the
publish route falls back to the existing customer_gallery_assigned "your
galleries" email (sent per assigned active account in their preferred language)
so registered customers learn the gallery is available. Inline-email path
(gallery_created) is unchanged.

The publish dialog now reflects this: with an inline email it notifies that
address; with only assigned accounts it says the account(s) will be notified;
with neither, the button is just "Publish" (no false notify promise). Exports
notifyCustomerOfNewAssignments; EN/DE strings added.
This commit is contained in:
Luca
2026-06-26 15:26:28 +02:00
parent 3ccaed06a2
commit c657892bc8
6 changed files with 42 additions and 7 deletions
@@ -7,6 +7,8 @@ interface PublishGalleryDialogProps {
eventName: string;
requirePassword: boolean;
customerEmail?: string | null;
/** Assigned customer accounts — notified via the account "your galleries" email when there's no inline email. */
assignedCustomerCount?: number;
isPublishing: boolean;
onConfirm: (password?: string) => void;
onClose: () => void;
@@ -28,11 +30,15 @@ export const PublishGalleryDialog: React.FC<PublishGalleryDialogProps> = ({
eventName,
requirePassword,
customerEmail,
assignedCustomerCount = 0,
isPublishing,
onConfirm,
onClose,
}) => {
const { t } = useTranslation();
// Someone gets notified if there's an inline email OR an assigned account
// (the latter via the account "your galleries" email).
const willNotify = !!customerEmail || assignedCustomerCount > 0;
const [password, setPassword] = useState('');
const [showPassword, setShowPassword] = useState(false);
const [error, setError] = useState<string | undefined>(undefined);
@@ -72,11 +78,18 @@ export const PublishGalleryDialog: React.FC<PublishGalleryDialogProps> = ({
defaultValue:
'Publishing "{{eventName}}" makes the gallery accessible and sends the notification email to {{customerEmail}}.',
})
: t('events.publishDialog.descriptionNoEmail', {
eventName,
defaultValue:
'Publishing "{{eventName}}" makes the gallery accessible. No customer email is set, so no notification will be sent.',
})}
: assignedCustomerCount > 0
? t('events.publishDialog.descriptionAssignedAccount', {
eventName,
count: assignedCustomerCount,
defaultValue:
'Publishing "{{eventName}}" makes the gallery accessible. The assigned customer account(s) will be notified by email (in their language) that it is available.',
})
: t('events.publishDialog.descriptionNoEmail', {
eventName,
defaultValue:
'Publishing "{{eventName}}" makes the gallery accessible. No customer email is set, so no notification will be sent.',
})}
</p>
{requirePassword && customerEmail && (
@@ -124,10 +137,10 @@ export const PublishGalleryDialog: React.FC<PublishGalleryDialogProps> = ({
onClick={handleSubmit}
disabled={isPublishing}
isLoading={isPublishing}
leftIcon={<Send className="w-4 h-4" />}
leftIcon={willNotify ? <Send className="w-4 h-4" /> : undefined}
className="flex-1"
>
{t('events.publishAndNotify')}
{willNotify ? t('events.publishAndNotify') : t('events.publishDialog.justPublish', 'Publish')}
</Button>
</div>
</Card>