diff --git a/client/src/campaigns/CUD.js b/client/src/campaigns/CUD.js index 72044ba7..cb38f3b8 100644 --- a/client/src/campaigns/CUD.js +++ b/client/src/campaigns/CUD.js @@ -36,6 +36,7 @@ import {getMailerTypes} from "../send-configurations/helpers"; import {getCampaignLabels} from "./helpers"; import {withComponentMixins} from "../lib/decorator-helpers"; import interoperableErrors from "../../../shared/interoperable-errors"; +import {Trans} from "react-i18next"; @withComponentMixins([ withTranslation, @@ -104,6 +105,7 @@ export default class CUD extends Component { this.nextListEntryId = 0; this.initForm({ + leaveConfirmation: !props.entity || props.entity.permissions.includes('edit'), onChange: { send_configuration: ::this.onSendConfigurationChanged }, @@ -535,6 +537,7 @@ export default class CUD extends Component { render() { const t = this.props.t; const isEdit = !!this.props.entity; + const canModify = !isEdit || this.props.entity.permissions.includes('edit'); const canDelete = isEdit && this.props.entity.permissions.includes('delete'); let extraSettings = null; @@ -751,6 +754,12 @@ export default class CUD extends Component { {isEdit ? this.editTitles[this.getFormValue('type')] : this.createTitles[this.getFormValue('type')]} + {!canModify && +
+ Warning! You do not have necessary permissions to edit this campaign. Any changes that you perform here will be lost. +
+ } + {isEdit && this.props.entity.status === CampaignStatus.SENDING &&
{t('formCannotBeEditedBecauseTheCampaignIs')} @@ -808,13 +817,17 @@ export default class CUD extends Component { {templateEdit} - {!isEdit && (sourceTypeKey === CampaignSource.CUSTOM || sourceTypeKey === CampaignSource.CUSTOM_FROM_TEMPLATE || sourceTypeKey === CampaignSource.CUSTOM_FROM_CAMPAIGN) ? -