Fix for #659
This commit is contained in:
parent
ebb6c2ff74
commit
a17ee3d9bf
3 changed files with 46 additions and 16 deletions
|
@ -35,6 +35,7 @@ import moment from 'moment';
|
|||
import {getMailerTypes} from "../send-configurations/helpers";
|
||||
import {getCampaignLabels} from "./helpers";
|
||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import interoperableErrors from "../../../shared/interoperable-errors";
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
@ -157,6 +158,7 @@ export default class CUD extends Component {
|
|||
if (sendConfigurationId) {
|
||||
this.fetchSendConfigurationId = sendConfigurationId;
|
||||
|
||||
try {
|
||||
const result = await axios.get(getUrl(`rest/send-configurations-public/${sendConfigurationId}`));
|
||||
|
||||
if (sendConfigurationId === this.fetchSendConfigurationId) {
|
||||
|
@ -164,6 +166,15 @@ export default class CUD extends Component {
|
|||
sendConfiguration: result.data
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
if (err instanceof interoperableErrors.PermissionDeniedError) {
|
||||
this.setState({
|
||||
sendConfiguration: null
|
||||
});
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -490,7 +490,8 @@ export default class Status extends Component {
|
|||
|
||||
this.state = {
|
||||
entity: props.entity,
|
||||
sendConfiguration: null
|
||||
sendConfiguration: null,
|
||||
sendConfigurationNotPermitted: false
|
||||
};
|
||||
|
||||
const { campaignTypeLabels, campaignStatusLabels } = getCampaignLabels(t);
|
||||
|
@ -507,18 +508,26 @@ export default class Status extends Component {
|
|||
|
||||
@withAsyncErrorHandler
|
||||
async refreshEntity() {
|
||||
const newState = {}
|
||||
|
||||
let resp;
|
||||
|
||||
resp = await axios.get(getUrl(`rest/campaigns-stats/${this.props.entity.id}`));
|
||||
const entity = resp.data;
|
||||
newState.entity = resp.data;
|
||||
|
||||
resp = await axios.get(getUrl(`rest/send-configurations-public/${entity.send_configuration}`));
|
||||
const sendConfiguration = resp.data;
|
||||
try {
|
||||
resp = await axios.get(getUrl(`rest/send-configurations-public/${newState.entity.send_configuration}`));
|
||||
newState.sendConfiguration = resp.data;
|
||||
} catch (err) {
|
||||
if (err instanceof interoperableErrors.PermissionDeniedError) {
|
||||
newState.sendConfiguration = null;
|
||||
newState.sendConfigurationNotPermitted = true;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({
|
||||
entity,
|
||||
sendConfiguration
|
||||
});
|
||||
this.setState(newState);
|
||||
}
|
||||
|
||||
async periodicRefreshTask() {
|
||||
|
@ -562,9 +571,13 @@ export default class Status extends Component {
|
|||
addOverridable('from_email', t('fromEmailAddress'));
|
||||
addOverridable('reply_to', t('replytoEmailAddress'));
|
||||
sendSettings.push(<AlignedRow key="subject" label={t('subjectLine')}>{entity.subject}</AlignedRow>);
|
||||
} else {
|
||||
if (this.state.sendConfigurationNotPermitted) {
|
||||
sendSettings = null;
|
||||
} else {
|
||||
sendSettings = <AlignedRow>{t('loadingSendConfiguration')}</AlignedRow>
|
||||
}
|
||||
}
|
||||
|
||||
const listsColumns = [
|
||||
{ data: 1, title: t('name') },
|
||||
|
|
|
@ -150,12 +150,18 @@ class Table extends Component {
|
|||
values: keysToFetch
|
||||
});
|
||||
|
||||
const oldSelectionMap = this.selectionMap;
|
||||
this.selectionMap = new Map();
|
||||
for (const row of response.data) {
|
||||
const key = row[this.props.selectionKeyIndex];
|
||||
if (this.selectionMap.has(key)) {
|
||||
this.selectionMap.set(key, row);
|
||||
if (oldSelectionMap.has(key)) {
|
||||
this.selectionMap.set(key, row)
|
||||
}
|
||||
}
|
||||
|
||||
if (this.selectionMap.size !== oldSelectionMap.size) {
|
||||
this.notifySelection(this.props.onSelectionChangedAsync, this.selectionMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue