Refactor opt-in confirmation behaviour in subscriber update API.
- Updating a subscriber no longer triggers an opt-in confirmation mail as `POST /api/subscribers/:id/optin` allows that. - A "Send opt-in confirmation" option is added to the subscriber update UI. Closes #656.
This commit is contained in:
parent
c95427e299
commit
04ea18c87d
19 changed files with 63 additions and 8 deletions
|
@ -367,10 +367,6 @@ func handleUpdateSubscriber(c echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if !req.PreconfirmSubs && app.constants.SendOptinConfirmation {
|
||||
_, _ = sendOptinConfirmation(sub, []int64(req.Lists), app)
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, okResp{sub})
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,9 @@ export const createSubscriber = (data) => http.post('/api/subscribers', data,
|
|||
export const updateSubscriber = (data) => http.put(`/api/subscribers/${data.id}`, data,
|
||||
{ loading: models.subscribers });
|
||||
|
||||
export const sendSubscriberOptin = (id) => http.post(`/api/subscribers/${id}/optin`, {},
|
||||
{ loading: models.subscribers });
|
||||
|
||||
export const deleteSubscriber = (id) => http.delete(`/api/subscribers/${id}`,
|
||||
{ loading: models.subscribers });
|
||||
|
||||
|
|
|
@ -104,6 +104,10 @@ section {
|
|||
}
|
||||
}
|
||||
|
||||
.is-disabled {
|
||||
opacity: 0.30;
|
||||
}
|
||||
|
||||
.box {
|
||||
background: $white;
|
||||
box-shadow: 2px 2px 0 #f3f3f3;
|
||||
|
|
|
@ -48,10 +48,22 @@
|
|||
:all="lists.results"
|
||||
></list-selector>
|
||||
|
||||
<b-field :message="$t('subscribers.preconfirmHelp')">
|
||||
<b-checkbox v-model="form.preconfirm"
|
||||
:native-value="true">{{ $t('subscribers.preconfirm') }}</b-checkbox>
|
||||
</b-field>
|
||||
<div class="columns mb-5">
|
||||
<div class="column is-7">
|
||||
<b-field :message="$t('subscribers.preconfirmHelp')">
|
||||
<b-checkbox v-model="form.preconfirm"
|
||||
:native-value="true" :disabled="!hasOptinList">
|
||||
{{ $t('subscribers.preconfirm') }}
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
</div>
|
||||
<div class="column is-5 has-text-right" v-if="isEditing">
|
||||
<a href="" @click.prevent="sendOptinConfirmation"
|
||||
:class="{'is-disabled': !hasOptinList}">
|
||||
<b-icon icon="email-outline" size="is-small" />
|
||||
{{ $t('subscribers.sendOptinConfirm') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<b-field :label="$t('subscribers.attribs')" label-position="on-border"
|
||||
:message="$t('subscribers.attribsHelp') + ' ' + egAttribs">
|
||||
|
@ -250,6 +262,12 @@ export default Vue.extend({
|
|||
});
|
||||
},
|
||||
|
||||
sendOptinConfirmation() {
|
||||
this.$api.sendSubscriberOptin(this.form.id).then(() => {
|
||||
this.$utils.toast(this.$t('subscribers.sentOptinConfirm'));
|
||||
});
|
||||
},
|
||||
|
||||
validateAttribs(str) {
|
||||
// Parse and validate attributes JSON.
|
||||
let attribs = {};
|
||||
|
@ -271,6 +289,10 @@ export default Vue.extend({
|
|||
|
||||
computed: {
|
||||
...mapState(['lists', 'loading']),
|
||||
|
||||
hasOptinList() {
|
||||
return this.form.lists.some((l) => l.optin === 'double');
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "E-mail nebo jméno",
|
||||
"subscribers.reset": "Reset",
|
||||
"subscribers.selectAll": "Vybrat vše {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Uvedeno na seznamu blokovaných",
|
||||
"subscribers.status.confirmed": "Potvrzeno",
|
||||
"subscribers.status.enabled": "Povoleno",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "E-Mail oder Name",
|
||||
"subscribers.reset": "Zurücksetzen",
|
||||
"subscribers.selectAll": "Wähle alle {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Blockiert",
|
||||
"subscribers.status.confirmed": "Bestätigt",
|
||||
"subscribers.status.enabled": "Aktiviert",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "E-mail or name",
|
||||
"subscribers.reset": "Reset",
|
||||
"subscribers.selectAll": "Select all {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Blocklisted",
|
||||
"subscribers.status.confirmed": "Confirmed",
|
||||
"subscribers.status.enabled": "Enabled",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "Correo electrónico o nombre",
|
||||
"subscribers.reset": "Restablecer",
|
||||
"subscribers.selectAll": "Seleccionar todos {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Bloqueado",
|
||||
"subscribers.status.confirmed": "Confirmado",
|
||||
"subscribers.status.enabled": "Habilitado",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "Email ou nom",
|
||||
"subscribers.reset": "Réinitialiser",
|
||||
"subscribers.selectAll": "Sélectionner tout {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Bloqué·e",
|
||||
"subscribers.status.confirmed": "Confirmé·e",
|
||||
"subscribers.status.enabled": "Activé·e",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "E-mail vagy név",
|
||||
"subscribers.reset": "Visszaállítás",
|
||||
"subscribers.selectAll": "Összes kijelölése {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Feketelistás",
|
||||
"subscribers.status.confirmed": "Megerősített",
|
||||
"subscribers.status.enabled": "Engedélyezve",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "Email o nome",
|
||||
"subscribers.reset": "Ripristina",
|
||||
"subscribers.selectAll": "Seleziona tutto {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Lista bloccata",
|
||||
"subscribers.status.confirmed": "Confermato",
|
||||
"subscribers.status.enabled": "Attivata",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "പേരോ ഇ-മെയിൽ വിലാസമോ",
|
||||
"subscribers.reset": "പുനഃസജ്ജമാക്കുക",
|
||||
"subscribers.selectAll": "{num} എല്ലാം തിരഞ്ഞടുക്കുക",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "തടയുന്ന പട്ടികയിൽ ചേർത്തു",
|
||||
"subscribers.status.confirmed": "Confirmed",
|
||||
"subscribers.status.enabled": "പ്രവർത്തനക്ഷമാക്കി",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "E-mail of naam",
|
||||
"subscribers.reset": "Resetten",
|
||||
"subscribers.selectAll": "Selecteer alle {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Geblokkeerd",
|
||||
"subscribers.status.confirmed": "Bevestigd",
|
||||
"subscribers.status.enabled": "Geactiveerd",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "E-mail lub nazwa",
|
||||
"subscribers.reset": "Resetuj",
|
||||
"subscribers.selectAll": "Wybierz wszystkich {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Zablokowany",
|
||||
"subscribers.status.confirmed": "Potwierdzony",
|
||||
"subscribers.status.enabled": "Aktywny",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "E-mail ou nome",
|
||||
"subscribers.reset": "Redefinir",
|
||||
"subscribers.selectAll": "Selecionar todos {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Lista de bloqueados",
|
||||
"subscribers.status.confirmed": "Confirmado",
|
||||
"subscribers.status.enabled": "Habilitado",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "E-mail ou nome",
|
||||
"subscribers.reset": "Repor",
|
||||
"subscribers.selectAll": "Selecionar todos os {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Bloqueados",
|
||||
"subscribers.status.confirmed": "Confirmado",
|
||||
"subscribers.status.enabled": "Ativo",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "Email sau nume",
|
||||
"subscribers.reset": "Reset",
|
||||
"subscribers.selectAll": "Selectează tot {număr}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "În lista neagră",
|
||||
"subscribers.status.confirmed": "Confirmat",
|
||||
"subscribers.status.enabled": "Activfat",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "E-mail или имя",
|
||||
"subscribers.reset": "Сброс",
|
||||
"subscribers.selectAll": "Выбрать все {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Заблокирован",
|
||||
"subscribers.status.confirmed": "Подтверждён",
|
||||
"subscribers.status.enabled": "Включён",
|
||||
|
|
|
@ -479,6 +479,8 @@
|
|||
"subscribers.queryPlaceholder": "E-posta veya isim",
|
||||
"subscribers.reset": "Sıfırla",
|
||||
"subscribers.selectAll": "Select all {num}",
|
||||
"subscribers.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"subscribers.sentOptinConfirm": "Opt-in confirmation sent",
|
||||
"subscribers.status.blocklisted": "Engellenmiş",
|
||||
"subscribers.status.confirmed": "Doğrulanmış",
|
||||
"subscribers.status.enabled": "Etkinleştirildi",
|
||||
|
|
Loading…
Reference in a new issue