mirror of
https://github.com/knadh/listmonk.git
synced 2025-10-09 23:06:36 +08:00
Fix incorrect IDs being sent from the bounce blocklist UI.
This commit is contained in:
parent
42c74a8d93
commit
a33c8e87fe
1 changed files with 35 additions and 29 deletions
|
@ -11,37 +11,42 @@
|
||||||
|
|
||||||
<b-table :data="bounces.results" :hoverable="true" :loading="loading.bounces" default-sort="createdAt" checkable
|
<b-table :data="bounces.results" :hoverable="true" :loading="loading.bounces" default-sort="createdAt" checkable
|
||||||
@check-all="onTableCheck" @check="onTableCheck" :checked-rows.sync="bulk.checked" detailed show-detail-icon
|
@check-all="onTableCheck" @check="onTableCheck" :checked-rows.sync="bulk.checked" detailed show-detail-icon
|
||||||
paginated backend-pagination pagination-position="both" @page-change="onPageChange" :current-page="queryParams.page" :per-page="bounces.perPage"
|
paginated backend-pagination pagination-position="both" @page-change="onPageChange"
|
||||||
:total="bounces.total" backend-sorting @sort="onSort">
|
:current-page="queryParams.page" :per-page="bounces.perPage" :total="bounces.total" backend-sorting
|
||||||
|
@sort="onSort">
|
||||||
<template #top-left>
|
<template #top-left>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<template v-if="bulk.checked.length > 0">
|
<template v-if="bulk.checked.length > 0">
|
||||||
<a class="a" href="#" @click.prevent="$utils.confirm($t('bounces.bouncesDeleted', { num: numSelectedBounces }), () => deleteBounces())" data-cy="btn-delete">
|
<a class="a" href="#"
|
||||||
<b-icon icon="trash-can-outline" size="is-small" /> {{ $t('globals.buttons.clear') }}
|
@click.prevent="$utils.confirm($t('bounces.bouncesDeleted', { num: numSelectedBounces }), () => deleteBounces())"
|
||||||
|
data-cy="btn-delete">
|
||||||
|
<b-icon icon="trash-can-outline" size="is-small" /> {{ $t('globals.buttons.delete') }}
|
||||||
</a>
|
</a>
|
||||||
<a class="a" href="#" @click.prevent="$utils.confirm($t('bounces.confirmBlocklist', { num: numSelectedBounces }), () => blocklistBounces())" data-cy="btn-manage-blocklist">
|
<a class="a" href="#"
|
||||||
|
@click.prevent="$utils.confirm($t('bounces.confirmBlocklist', { num: numSelectedBounces }), () => blocklistSubscribers())"
|
||||||
|
data-cy="btn-manage-blocklist">
|
||||||
<b-icon icon="account-off-outline" size="is-small" /> {{ $t('settings.bounces.blocklist') }}
|
<b-icon icon="account-off-outline" size="is-small" /> {{ $t('settings.bounces.blocklist') }}
|
||||||
</a>
|
</a>
|
||||||
<span>
|
<span>
|
||||||
{{ $t('bounces.numSelected', { num: numSelectedBounces }) }}
|
{{ $t('bounces.numSelected', { num: numSelectedBounces }) }}
|
||||||
<span v-if="!bulk.all && bounces.total > bounces.perPage">
|
<span v-if="!bulk.all && bounces.total > bounces.perPage">
|
||||||
—
|
—
|
||||||
<a href="#" @click.prevent="selectAllBounces">
|
<a href="#" @click.prevent="selectAllBounces">
|
||||||
{{ $t('bounces.selectAll', { num: bounces.total }) }}
|
{{ $t('bounces.selectAll', { num: bounces.total }) }}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<b-table-column v-slot="props" field="email" :label="$t('subscribers.email')" :td-attrs="$utils.tdID" sortable>
|
<b-table-column v-slot="props" field="email" :label="$t('subscribers.email')" :td-attrs="$utils.tdID" sortable>
|
||||||
<router-link
|
<router-link :to="{ name: 'subscriber', params: { id: props.row.subscriberId } }"
|
||||||
:to="{ name: 'subscriber', params: { id: props.row.subscriberId } }"
|
:class="{ 'blocklisted': props.row.subscriberStatus === 'blocklisted' }">
|
||||||
:class="{ 'blocklisted': props.row.subscriberStatus === 'blocklisted' }">
|
|
||||||
{{ props.row.email }}
|
{{ props.row.email }}
|
||||||
<b-tag v-if="props.row.subscriberStatus !== 'enabled'" :class="props.row.subscriberStatus" data-cy="blocklisted">
|
<b-tag v-if="props.row.subscriberStatus !== 'enabled'" :class="props.row.subscriberStatus"
|
||||||
{{ $t(`subscribers.status.${props.row.subscriberStatus}`) }}
|
data-cy="blocklisted">
|
||||||
</b-tag>
|
{{ $t(`subscribers.status.${props.row.subscriberStatus}`) }}
|
||||||
|
</b-tag>
|
||||||
</router-link>
|
</router-link>
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
|
|
||||||
|
@ -169,36 +174,37 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteBounces() {
|
deleteBounces() {
|
||||||
const count = this.numSelectedBounces;
|
const cb = () => {
|
||||||
const fnSuccess = () => {
|
|
||||||
this.getBounces();
|
this.getBounces();
|
||||||
this.$utils.toast(this.$t(
|
this.$utils.toast(this.$t(
|
||||||
'globals.messages.deletedCount',
|
'globals.messages.deletedCount',
|
||||||
{ name: this.$tc('globals.terms.bounces'), num: count },
|
{ name: this.$tc('globals.terms.bounces'), num: this.numSelectedBounces },
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
if (!this.bulk.all && this.bulk.checked.length > 0) {
|
if (!this.bulk.all && this.bulk.checked.length > 0) {
|
||||||
const ids = this.bulk.checked.map((s) => s.id);
|
const ids = this.bulk.checked.map((s) => s.id);
|
||||||
this.$api.deleteBounces({ id: ids }).then(fnSuccess);
|
this.$api.deleteBounces({ id: ids }).then(cb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$api.deleteSubscribersByQuery({ all: true }).then(fnSuccess);
|
this.$api.deleteSubscribersByQuery({ all: true }).then(cb);
|
||||||
},
|
},
|
||||||
blocklistBounces() {
|
|
||||||
const count = this.numSelectedBounces;
|
blocklistSubscribers() {
|
||||||
const fnSuccess = () => {
|
const cb = () => {
|
||||||
this.getBounces();
|
this.getBounces();
|
||||||
this.$utils.toast(this.$t(
|
this.$utils.toast(this.$t(
|
||||||
'globals.messages.blocklistedCount',
|
'globals.messages.blocklistedCount',
|
||||||
{ name: this.$tc('globals.terms.bounces'), num: count },
|
{ name: this.$tc('globals.terms.bounces'), num: this.numSelectedBounces },
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!this.bulk.all && this.bulk.checked.length > 0) {
|
if (!this.bulk.all && this.bulk.checked.length > 0) {
|
||||||
const subscriberIds = this.bulk.checked.map((s) => s.id);
|
const subIds = this.bulk.checked.map((s) => s.subscriberId);
|
||||||
this.$api.blocklistSubscribers({ ids: subscriberIds }).then(fnSuccess);
|
this.$api.blocklistSubscribers({ ids: subIds }).then(cb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$api.blocklistSubscribersByQuery({ all: true }).then(fnSuccess);
|
|
||||||
|
this.$api.blocklistSubscribersByQuery({ all: true }).then(cb);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue