Add option to toggle sending opt-in confirmation. Closes #363.
This commit is contained in:
parent
51da1a16a0
commit
e71115db26
18 changed files with 81 additions and 36 deletions
19
cmd/init.go
19
cmd/init.go
|
@ -46,15 +46,16 @@ const (
|
|||
|
||||
// constants contains static, constant config values required by the app.
|
||||
type constants struct {
|
||||
RootURL string `koanf:"root_url"`
|
||||
LogoURL string `koanf:"logo_url"`
|
||||
FaviconURL string `koanf:"favicon_url"`
|
||||
FromEmail string `koanf:"from_email"`
|
||||
NotifyEmails []string `koanf:"notify_emails"`
|
||||
EnablePublicSubPage bool `koanf:"enable_public_subscription_page"`
|
||||
Lang string `koanf:"lang"`
|
||||
DBBatchSize int `koanf:"batch_size"`
|
||||
Privacy struct {
|
||||
RootURL string `koanf:"root_url"`
|
||||
LogoURL string `koanf:"logo_url"`
|
||||
FaviconURL string `koanf:"favicon_url"`
|
||||
FromEmail string `koanf:"from_email"`
|
||||
NotifyEmails []string `koanf:"notify_emails"`
|
||||
EnablePublicSubPage bool `koanf:"enable_public_subscription_page"`
|
||||
SendOptinConfirmation bool `koanf:"send_optin_confirmation"`
|
||||
Lang string `koanf:"lang"`
|
||||
DBBatchSize int `koanf:"batch_size"`
|
||||
Privacy struct {
|
||||
IndividualTracking bool `koanf:"individual_tracking"`
|
||||
AllowBlocklist bool `koanf:"allow_blocklist"`
|
||||
AllowExport bool `koanf:"allow_export"`
|
||||
|
|
|
@ -14,14 +14,15 @@ import (
|
|||
)
|
||||
|
||||
type settings struct {
|
||||
AppRootURL string `json:"app.root_url"`
|
||||
AppLogoURL string `json:"app.logo_url"`
|
||||
AppFaviconURL string `json:"app.favicon_url"`
|
||||
AppFromEmail string `json:"app.from_email"`
|
||||
AppNotifyEmails []string `json:"app.notify_emails"`
|
||||
EnablePublicSubPage bool `json:"app.enable_public_subscription_page"`
|
||||
CheckUpdates bool `json:"app.check_updates"`
|
||||
AppLang string `json:"app.lang"`
|
||||
AppRootURL string `json:"app.root_url"`
|
||||
AppLogoURL string `json:"app.logo_url"`
|
||||
AppFaviconURL string `json:"app.favicon_url"`
|
||||
AppFromEmail string `json:"app.from_email"`
|
||||
AppNotifyEmails []string `json:"app.notify_emails"`
|
||||
EnablePublicSubPage bool `json:"app.enable_public_subscription_page"`
|
||||
SendOptinConfirmation bool `json:"app.send_optin_confirmation"`
|
||||
CheckUpdates bool `json:"app.check_updates"`
|
||||
AppLang string `json:"app.lang"`
|
||||
|
||||
AppBatchSize int `json:"app.batch_size"`
|
||||
AppConcurrency int `json:"app.concurrency"`
|
||||
|
|
|
@ -367,7 +367,7 @@ func handleUpdateSubscriber(c echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if !req.PreconfirmSubs {
|
||||
if !req.PreconfirmSubs && app.constants.SendOptinConfirmation {
|
||||
_, _ = sendOptinConfirmation(sub, []int64(req.Lists), app)
|
||||
}
|
||||
|
||||
|
@ -725,7 +725,7 @@ func insertSubscriber(req subimporter.SubReq, app *App) (models.Subscriber, bool
|
|||
}
|
||||
|
||||
hasOptin := false
|
||||
if !req.PreconfirmSubs {
|
||||
if !req.PreconfirmSubs && app.constants.SendOptinConfirmation {
|
||||
// Send a confirmation e-mail (if there are any double opt-in lists).
|
||||
num, _ := sendOptinConfirmation(sub, []int64(req.Lists), app)
|
||||
hasOptin = num > 0
|
||||
|
|
|
@ -6,17 +6,22 @@
|
|||
placeholder='https://listmonk.yoursite.com' :maxlength="300" />
|
||||
</b-field>
|
||||
|
||||
<b-field :label="$t('settings.general.logoURL')" label-position="on-border"
|
||||
:message="$t('settings.general.logoURLHelp')">
|
||||
<b-input v-model="data['app.logo_url']" name="app.logo_url"
|
||||
placeholder='https://listmonk.yoursite.com/logo.png' :maxlength="300" />
|
||||
</b-field>
|
||||
|
||||
<b-field :label="$t('settings.general.faviconURL')" label-position="on-border"
|
||||
:message="$t('settings.general.faviconURLHelp')">
|
||||
<b-input v-model="data['app.favicon_url']" name="app.favicon_url"
|
||||
placeholder='https://listmonk.yoursite.com/favicon.png' :maxlength="300" />
|
||||
</b-field>
|
||||
<div class="columns">
|
||||
<div class="column is-6">
|
||||
<b-field :label="$t('settings.general.logoURL')" label-position="on-border"
|
||||
:message="$t('settings.general.logoURLHelp')">
|
||||
<b-input v-model="data['app.logo_url']" name="app.logo_url"
|
||||
placeholder='https://listmonk.yoursite.com/logo.png' :maxlength="300" />
|
||||
</b-field>
|
||||
</div>
|
||||
<div class="column is-6">
|
||||
<b-field :label="$t('settings.general.faviconURL')" label-position="on-border"
|
||||
:message="$t('settings.general.faviconURLHelp')">
|
||||
<b-input v-model="data['app.favicon_url']" name="app.favicon_url"
|
||||
placeholder='https://listmonk.yoursite.com/favicon.png' :maxlength="300" />
|
||||
</b-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<b-field :label="$t('settings.general.fromEmail')" label-position="on-border"
|
||||
|
@ -25,7 +30,6 @@
|
|||
placeholder='Listmonk <noreply@listmonk.yoursite.com>'
|
||||
pattern="(.+?)\s<(.+?)@(.+?)>" :maxlength="300" />
|
||||
</b-field>
|
||||
|
||||
<b-field :label="$t('settings.general.adminNotifEmails')" label-position="on-border"
|
||||
:message="$t('settings.general.adminNotifEmailsHelp')">
|
||||
<b-taginput v-model="data['app.notify_emails']" name="app.notify_emails"
|
||||
|
@ -33,12 +37,25 @@
|
|||
placeholder='you@yoursite.com' />
|
||||
</b-field>
|
||||
|
||||
<b-field :label="$t('settings.general.enablePublicSubPage')"
|
||||
:message="$t('settings.general.enablePublicSubPageHelp')">
|
||||
<b-switch v-model="data['app.enable_public_subscription_page']"
|
||||
name="app.enable_public_subscription_page" />
|
||||
</b-field>
|
||||
<hr />
|
||||
<div class="columns">
|
||||
<div class="column is-6">
|
||||
<b-field :label="$t('settings.general.enablePublicSubPage')"
|
||||
:message="$t('settings.general.enablePublicSubPageHelp')">
|
||||
<b-switch v-model="data['app.enable_public_subscription_page']"
|
||||
name="app.enable_public_subscription_page" />
|
||||
</b-field>
|
||||
</div>
|
||||
<div class="column is-6">
|
||||
<b-field :label="$t('settings.general.sendOptinConfirm')"
|
||||
:message="$t('settings.general.sendOptinConfirmHelp')">
|
||||
<b-switch v-model="data['app.send_optin_confirmation']"
|
||||
name="app.send_optin_confirmation" />
|
||||
</b-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<b-field :label="$t('settings.general.checkUpdates')"
|
||||
:message="$t('settings.general.checkUpdatesHelp')">
|
||||
<b-switch v-model="data['app.check_updates']"
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "Obecné",
|
||||
"settings.general.rootURL": "Kořenová adresa URL",
|
||||
"settings.general.rootURLHelp": "Veřejná adresa URL instalace (bez koncového lomítka).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "Neplatné jméno kurýra.",
|
||||
"settings.mailserver.authProtocol": "Ověřovací protokol",
|
||||
"settings.mailserver.host": "Hostitel",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "Allgemein",
|
||||
"settings.general.rootURL": "Root URL",
|
||||
"settings.general.rootURLHelp": "Öffentliche URL der Installation (ohne Slash am Ende).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "Der Name des Messengers ist ungültig",
|
||||
"settings.mailserver.authProtocol": "Autentifizierungsprotokoll",
|
||||
"settings.mailserver.host": "Server",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "General",
|
||||
"settings.general.rootURL": "Root URL",
|
||||
"settings.general.rootURLHelp": "Public URL of the installation (no trailing slash).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "Send an opt-in confirmation e-mail when subscribers signup via the public form or when they are added by the admin.",
|
||||
"settings.invalidMessengerName": "Invalid messenger name.",
|
||||
"settings.mailserver.authProtocol": "Auth protocol",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "General",
|
||||
"settings.general.rootURL": "URL raíz",
|
||||
"settings.general.rootURLHelp": "URL pública de la instalación (sin la barra final)",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "Nombre de mensajero inválido.",
|
||||
"settings.mailserver.authProtocol": "Protocolo de autenticación",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "Général",
|
||||
"settings.general.rootURL": "URL racine",
|
||||
"settings.general.rootURLHelp": "URL publique de l'installation (sans slash final)",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "Nom de messagerie invalide",
|
||||
"settings.mailserver.authProtocol": "Protocole d'authentification",
|
||||
"settings.mailserver.host": "Hôte",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "Generale",
|
||||
"settings.general.rootURL": "Radice dell'URL",
|
||||
"settings.general.rootURLHelp": "URL pubblico dell'installazione (senza barra obliqua finale).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "Nome di messaggeria non valido.",
|
||||
"settings.mailserver.authProtocol": "Protocollo di autenticazione",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "പൊതുവായ",
|
||||
"settings.general.rootURL": "റൂട്ട് യൂ. ആർ. എൽ",
|
||||
"settings.general.rootURLHelp": "ഇൻസ്റ്റാളേഷന്റെ പൊതു യൂ. ആർ. എൽ (അവസാനത്തെ സ്ലാഷ് ആവശ്യമില്ല).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "സന്ദേശവാഹകന്റെ പേര് അസാധുവാണ്",
|
||||
"settings.mailserver.authProtocol": "പ്രാമാണീകരണ പ്രോട്ടോക്കോൾ",
|
||||
"settings.mailserver.host": "ഹോസ്റ്റ്",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "Ogólne",
|
||||
"settings.general.rootURL": "Bazowy URL",
|
||||
"settings.general.rootURLHelp": "Publiczny URL instalacji (bez slasha na końcu)",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "Nieprawidłowa nazwa komunikatora.",
|
||||
"settings.mailserver.authProtocol": "Protokół autoryzacji",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "Geral",
|
||||
"settings.general.rootURL": "URL base",
|
||||
"settings.general.rootURLHelp": "URL público da instalação (sem barra final).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "Nome de mensageiro inválido.",
|
||||
"settings.mailserver.authProtocol": "Protocolo Autenticação",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "Geral",
|
||||
"settings.general.rootURL": "URL base",
|
||||
"settings.general.rootURLHelp": "URL público da instalação (sem barra final).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "Nome de mensageiro inválido.",
|
||||
"settings.mailserver.authProtocol": "Protocolo Autenticação",
|
||||
"settings.mailserver.host": "Host",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "Основное",
|
||||
"settings.general.rootURL": "Базовый URL",
|
||||
"settings.general.rootURLHelp": "Публичный URL текущего портала (без конечного слэша).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "Неверное имя мессенджера.",
|
||||
"settings.mailserver.authProtocol": "Протокол авторизации",
|
||||
"settings.mailserver.host": "Хост",
|
||||
|
|
|
@ -332,6 +332,8 @@
|
|||
"settings.general.name": "Genel",
|
||||
"settings.general.rootURL": "Kök URL",
|
||||
"settings.general.rootURLHelp": "Kurulumun genel URL'si (bölme çizgisi yok).",
|
||||
"settings.general.sendOptinConfirm": "Send opt-in confirmation",
|
||||
"settings.general.sendOptinConfirmHelp": "When new subscribers signup or are added via the admin form, send an opt-in confirmation e-mail.",
|
||||
"settings.invalidMessengerName": "Geçersiz messenger adı.",
|
||||
"settings.mailserver.authProtocol": "Protokol",
|
||||
"settings.mailserver.host": "İstemci",
|
||||
|
|
|
@ -38,6 +38,7 @@ func V2_0_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
|
|||
|
||||
if _, err := db.Exec(`
|
||||
INSERT INTO settings (key, value) VALUES
|
||||
('app.send_optin_confirmation', 'true'),
|
||||
('bounce.enabled', 'false'),
|
||||
('bounce.webhooks_enabled', 'false'),
|
||||
('bounce.count', '2'),
|
||||
|
|
|
@ -183,6 +183,7 @@ INSERT INTO settings (key, value) VALUES
|
|||
('app.message_sliding_window_duration', '"1h"'),
|
||||
('app.message_sliding_window_rate', '10000'),
|
||||
('app.enable_public_subscription_page', 'true'),
|
||||
('app.send_optin_confirmation', 'true'),
|
||||
('app.check_updates', 'true'),
|
||||
('app.notify_emails', '["admin1@mysite.com", "admin2@mysite.com"]'),
|
||||
('app.lang', '"en"'),
|
||||
|
|
Loading…
Reference in a new issue