Some bugfixes

This commit is contained in:
Tomas Bures 2018-11-14 23:21:45 +01:00
parent a3983193d3
commit 8683f8c91e
6 changed files with 12 additions and 8 deletions

View file

@ -74,7 +74,7 @@ export class TestSendModalDialog extends Component {
data.sendConfigurationId = props.entity.send_configuration; data.sendConfigurationId = props.entity.send_configuration;
data.campaignId = props.entity.id; data.campaignId = props.entity.id;
console.log(await axios.post(getUrl('rest/template-test-send'), data)); await axios.post(getUrl('rest/template-test-send'), data);
this.clearFormStatusMessage(); this.clearFormStatusMessage();

View file

@ -286,7 +286,11 @@ export default class CUD extends Component {
} }
} }
onFileSelected() { onFileSelected(evt, x) {
if (!this.getFormValue('name') && this.csvFile.files.length > 0) {
this.updateFormValue('name', this.csvFile.files[0].name);
}
this.scheduleFormRevalidate(); this.scheduleFormRevalidate();
} }

View file

@ -71,7 +71,7 @@ export class TestSendModalDialog extends Component {
data.subscriptionCid = this.getFormValue('testUser'); data.subscriptionCid = this.getFormValue('testUser');
data.sendConfigurationId = this.getFormValue('sendConfiguration'); data.sendConfigurationId = this.getFormValue('sendConfiguration');
console.log(await axios.post(getUrl('rest/template-test-send'), data)); await axios.post(getUrl('rest/template-test-send'), data);
this.clearFormStatusMessage(); this.clearFormStatusMessage();

View file

@ -137,7 +137,7 @@ async function ajaxListWithPermissionsTx(tx, context, fetchSpecs, params, queryF
query = query.innerJoin( query = query.innerJoin(
function () { function () {
return this.from(entityType.permissionsTable).select('entity').where('user', context.user.id).whereIn('operation', fetchSpec.requiredOperations).as(`permitted__${fetchSpec.entityTypeId}`); return this.from(entityType.permissionsTable).distinct('entity').where('user', context.user.id).whereIn('operation', fetchSpec.requiredOperations).as(`permitted__${fetchSpec.entityTypeId}`);
}, },
`permitted__${fetchSpec.entityTypeId}.entity`, entityIdColumn) `permitted__${fetchSpec.entityTypeId}.entity`, entityIdColumn)
} }

View file

@ -478,7 +478,7 @@ async function remove(context, id) {
await triggers.removeAllByCampaignIdTx(tx, context, id); await triggers.removeAllByCampaignIdTx(tx, context, id);
await tx('template_dep_campaigns') await tx('template_dep_campaigns')
.where('campaign', entity.id) .where('campaign', id)
.del(); .del();
await tx('campaigns').where('id', id).del(); await tx('campaigns').where('id', id).del();

View file

@ -146,11 +146,11 @@ async function updateLinks(campaign, list, subscription, mergeTags, message) {
} }
if (!campaign.click_tracking_disabled) { if (!campaign.click_tracking_disabled) {
const re = /(<a[^>]* href\s*=[\s"']*)(http[^"'>\s]+)/gi; const re = /(<a[^>]* href\s*=\s*["']\s*)(http[^"'>\s]+)/gi;
const urlsToBeReplaced = new Set(); const urlsToBeReplaced = new Set();
message = message.replace(re, (match, prefix, encodedUrl) => { message.replace(re, (match, prefix, encodedUrl) => {
const url = he.decode(encodedUrl, {isAttributeValue: true}); const url = he.decode(encodedUrl, {isAttributeValue: true});
urlsToBeReplaced.add(url); urlsToBeReplaced.add(url);
}); });
@ -166,7 +166,7 @@ async function updateLinks(campaign, list, subscription, mergeTags, message) {
message = message.replace(re, (match, prefix, encodedUrl) => { message = message.replace(re, (match, prefix, encodedUrl) => {
const url = he.decode(encodedUrl, {isAttributeValue: true}); const url = he.decode(encodedUrl, {isAttributeValue: true});
const link = urls.get(url); const link = urls.get(url);
return getPublicUrl(`/links/${campaign.cid}/${list.cid}/${subscription.cid}/${link.cid}`); return prefix + (link ? getPublicUrl(`/links/${campaign.cid}/${list.cid}/${subscription.cid}/${link.cid}`) : url);
}); });
} }