Add support for publishing full content in public archive RSS feed body (#1262)

- Introduces a new option on the settings UI to optionally publish the full campaign body in
  public archive RSS feeds.

Closes #1033 

Co-authored-by: Kailash Nadh <kailash@nadh.in>
This commit is contained in:
Justin Beaty 2023-04-07 21:09:10 -07:00 committed by GitHub
parent 146e8e7a63
commit 476d5bebf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 176 additions and 43 deletions

View file

@ -16,6 +16,7 @@ import (
type campArchive struct {
UUID string `json:"uuid"`
Subject string `json:"subject"`
Content string `json:"content"`
CreatedAt null.Time `json:"created_at"`
SendAt null.Time `json:"send_at"`
URL string `json:"url"`
@ -28,7 +29,7 @@ func handleGetCampaignArchives(c echo.Context) error {
pg = app.paginator.NewFromURL(c.Request().URL.Query())
)
camps, total, err := getCampaignArchives(pg.Offset, pg.Limit, app)
camps, total, err := getCampaignArchives(pg.Offset, pg.Limit, false, app)
if err != nil {
return err
}
@ -51,11 +52,12 @@ func handleGetCampaignArchives(c echo.Context) error {
// handleGetCampaignArchivesFeed renders the public campaign archives RSS feed.
func handleGetCampaignArchivesFeed(c echo.Context) error {
var (
app = c.Get("app").(*App)
pg = app.paginator.NewFromURL(c.Request().URL.Query())
app = c.Get("app").(*App)
pg = app.paginator.NewFromURL(c.Request().URL.Query())
showFullContent = app.constants.EnablePublicArchiveRSSContent
)
camps, _, err := getCampaignArchives(pg.Offset, pg.Limit, app)
camps, _, err := getCampaignArchives(pg.Offset, pg.Limit, showFullContent, app)
if err != nil {
return err
}
@ -71,6 +73,7 @@ func handleGetCampaignArchivesFeed(c echo.Context) error {
out = append(out, &feeds.Item{
Title: c.Subject,
Link: &feeds.Link{Href: c.URL},
Content: c.Content,
Created: pubDate,
})
}
@ -97,7 +100,7 @@ func handleCampaignArchivesPage(c echo.Context) error {
pg = app.paginator.NewFromURL(c.Request().URL.Query())
)
out, total, err := getCampaignArchives(pg.Offset, pg.Limit, app)
out, total, err := getCampaignArchives(pg.Offset, pg.Limit, false, app)
if err != nil {
return err
}
@ -158,7 +161,28 @@ func handleCampaignArchivePage(c echo.Context) error {
return c.HTML(http.StatusOK, string(msg.Body()))
}
func getCampaignArchives(offset, limit int, app *App) ([]campArchive, int, error) {
// handleCampaignArchivePageLatest renders the latest public campaign.
func handleCampaignArchivePageLatest(c echo.Context) error {
var (
app = c.Get("app").(*App)
)
camps, _, err := getCampaignArchives(0, 1, true, app)
if err != nil {
return err
}
if len(camps) == 0 {
return c.Render(http.StatusNotFound, tplMessage,
makeMsgTpl(app.i18n.T("public.notFoundTitle"), "", app.i18n.T("public.campaignNotFound")))
}
camp := camps[0]
return c.HTML(http.StatusOK, camp.Content)
}
func getCampaignArchives(offset, limit int, renderBody bool, app *App) ([]campArchive, int, error) {
pubCamps, total, err := app.core.GetArchivedCampaigns(offset, limit)
if err != nil {
return []campArchive{}, total, echo.NewHTTPError(http.StatusInternalServerError, app.i18n.T("public.errorFetchingCampaign"))
@ -172,13 +196,24 @@ func getCampaignArchives(offset, limit int, app *App) ([]campArchive, int, error
out := make([]campArchive, 0, len(msgs))
for _, m := range msgs {
camp := m.Campaign
out = append(out, campArchive{
archive := campArchive{
UUID: camp.UUID,
Subject: camp.Subject,
CreatedAt: camp.CreatedAt,
SendAt: camp.SendAt,
URL: app.constants.ArchiveURL + "/" + camp.UUID,
})
}
if renderBody {
msg, err := app.manager.NewCampaignMessage(camp, m.Subscriber)
if err != nil {
return []campArchive{}, total, err
}
archive.Content = string(msg.Body())
}
out = append(out, archive)
}
return out, total, nil

View file

@ -202,6 +202,7 @@ func initHTTPHandlers(e *echo.Echo, app *App) {
e.GET("/archive", handleCampaignArchivesPage)
e.GET("/archive.xml", handleGetCampaignArchivesFeed)
e.GET("/archive/:uuid", handleCampaignArchivePage)
e.GET("/archive/latest", handleCampaignArchivePageLatest)
}
e.GET("/public/custom.css", serveCustomApperance("public.custom_css"))

View file

@ -59,6 +59,7 @@ type constants struct {
NotifyEmails []string `koanf:"notify_emails"`
EnablePublicSubPage bool `koanf:"enable_public_subscription_page"`
EnablePublicArchive bool `koanf:"enable_public_archive"`
EnablePublicArchiveRSSContent bool `koanf:"enable_public_archive_rss_content"`
SendOptinConfirmation bool `koanf:"send_optin_confirmation"`
Lang string `koanf:"lang"`
DBBatchSize int `koanf:"batch_size"`

View file

@ -35,6 +35,7 @@ var migList = []migFunc{
{"v2.2.0", migrations.V2_2_0},
{"v2.3.0", migrations.V2_3_0},
{"v2.4.0", migrations.V2_4_0},
{"v2.5.0", migrations.V2_5_0},
}
// upgrade upgrades the database to the current version by running SQL migration files

View file

@ -43,27 +43,45 @@
</b-field>
<hr />
<div class="columns">
<div class="column is-4">
<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>
<h2 class="is-size-4 mb-5">{{ $tc('globals.terms.subscriptions', 2) }}</h2>
<div class="columns">
<div class="column is-4">
<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-4">
<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>
<div class="column is-4">
<b-field :label="$t('settings.general.enablePublicArchive')"
:message="$t('settings.general.enablePublicArchiveHelp')">
<b-switch v-model="data['app.enable_public_archive']"
name="app.enable_public_archive" />
</b-field>
</div>
<div class="column is-4">
<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>
<hr />
<div>
<h2 class="is-size-4 mb-5">{{ $t('campaigns.archive') }}</h2>
<div class="columns">
<div class="column is-4">
<b-field :label="$t('settings.general.enablePublicArchive')"
:message="$t('settings.general.enablePublicArchiveHelp')">
<b-switch v-model="data['app.enable_public_archive']"
name="app.enable_public_archive" />
</b-field>
</div>
<div class="column is-4">
<b-field :label="$t('settings.general.enablePublicArchiveRSSContent')"
:message="$t('settings.general.enablePublicArchiveRSSContentHelp')">
<b-switch v-model="data['app.enable_public_archive_rss_content']"
name="app.enable_public_archive_rss_content" />
</b-field>
</div>
</div>
</div>

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Comprova periòdicament si hi ha noves versions d'aplicacions i notifica-ho.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publica les campanyes on arxivar està habilitat en el lloc web públic.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Activa la pàgina de subscripció pública",
"settings.general.enablePublicSubPageHelp": "Mostra una pàgina de subscripció pública amb totes les llistes públiques perquè la gent es subscrigui.",
"settings.general.faviconURL": "Favicon URL",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Pravidelně kontrolovat nová vydání aplikace a upozornit.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Zveřejnit kampaně, pro které je povolena archivace na veřejné web stránce.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Povolit veřejnou stránku odběru",
"settings.general.enablePublicSubPageHelp": "Zobrazit veřejnou stránku odběru se všemi veřejnými seznamy pro lidi k odběru.",
"settings.general.faviconURL": "Adresa URL ikony favicon",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Gwirio ar gyfer apiau newydd sy'n cael eu rhyddhau o bryd i'w gilydd.",
"settings.general.enablePublicArchive": "Galluogi archif rhestr bostio gyhoeddus",
"settings.general.enablePublicArchiveHelp": "Cyhoeddi ymgyrchoedd lle mae archifo wedi'i alluogi ar y wefan gyhoeddus.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Galluogi tudalen tanysgrifio gyhoeddus",
"settings.general.enablePublicSubPageHelp": "Dangos tudalen tanysgrifio gyhoeddus gyda'r holl restrau cyhoeddus y gall pobl danysgrifio iddynt.",
"settings.general.faviconURL": "URL Favicon",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Prüfe regelmäßig nach Aktualisierungen und benachrichtige mich.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Veröffentlichen Sie Kampagnen, für die die Archivierung aktiviert ist, auf der öffentlichen Website.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Aktiviere eine öffentliche Abonnement Seite",
"settings.general.enablePublicSubPageHelp": "Zeige eine öffentliche Abonnement Seite mit allen öffentlichen Listen, die Personen abonnieren können.",
"settings.general.faviconURL": "Favicon URL",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Periodically check for new app releases and notify.",
"settings.general.enablePublicArchive": "Enable public mailing list archive",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Enable public subscription page",
"settings.general.enablePublicSubPageHelp": "Show a public subscription page with all the public lists for people to subscribe.",
"settings.general.faviconURL": "Favicon URL",

View file

@ -378,6 +378,8 @@
"settings.general.checkUpdatesHelp": "Periódicamente buscar nuevas actualizaciones y notificarme.",
"settings.general.enablePublicArchive": "Habilitar la página de archivo público de listas de correo",
"settings.general.enablePublicArchiveHelp": "Publicar en la web pública campañas en las que el archivo público está habilitado.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Habilitar pagina pública de suscripción",
"settings.general.enablePublicSubPageHelp": "Muestra una página con todas las listas públicas para suscribirse.",
"settings.general.faviconURL": "URL del Favicon",

View file

@ -378,6 +378,8 @@
"settings.general.checkUpdatesHelp": "Periodically check for new app releases and notify.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Enable public subscription page",
"settings.general.enablePublicSubPageHelp": "Show a public subscription page with all the public lists for people to subscribe.",
"settings.general.faviconURL": "Favicon URL",

View file

@ -378,6 +378,8 @@
"settings.general.checkUpdatesHelp": "Vérifier régulièrement si de nouvelles applications sont disponibles et notifier-les.",
"settings.general.enablePublicArchive": "Activer la page publiques des emails archivés",
"settings.general.enablePublicArchiveHelp": "Publier les campagnes pour lesquelles l'archivage est activé sur le site web public.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Activer la page d'abonnement publique",
"settings.general.enablePublicSubPageHelp": "Afficher une page d'abonnement publique avec toutes les listes publiques auxquelles les personnes peuvent s'abonner.",
"settings.general.faviconURL": "URL du favicon",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Rendszeresen ellenőrizze, és értesítsen, ha új alkalmazásverzió érhető el.",
"settings.general.enablePublicArchive": "Nyilvános archívum",
"settings.general.enablePublicArchiveHelp": "Nyilvános archívum felület engedélyezése, melyen az archivált kampányok megtekinthetők.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Nyilvános feliratkozás",
"settings.general.enablePublicSubPageHelp": "Nyilvános feliratkozási felület engedélyezése, amelyen az összes nyilvános listára fel lehet iratkozni.",
"settings.general.faviconURL": "Favicon URL",

View file

@ -378,6 +378,8 @@
"settings.general.checkUpdatesHelp": "Rutinariamente controllare se ci sono nuove versioni dell'app e notificami.",
"settings.general.enablePublicArchive": "Abilita la pagina publica di archivio delle mail",
"settings.general.enablePublicArchiveHelp": "Rendere pubbliche le campagne in qui l'archivio pubblico nella pagina web è stato abilitato.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Attiva la pagina di iscrizione pubblica",
"settings.general.enablePublicSubPageHelp": "Visualizza una pagina di iscrizione pubblica con tutte le liste pubbliche a cui è possibile iscriversi.",
"settings.general.faviconURL": "URL della favicon",

View file

@ -378,6 +378,8 @@
"settings.general.checkUpdatesHelp": "定期的に新しいアプリのリリースを確認し、通知する。",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "公開ウエブサイトに公開アーカイブOK設定されたキャンペーンを発行する。",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "公開サブスクリプションページを有効にする。",
"settings.general.enablePublicSubPageHelp": "全ての公開リストを含む公開サブスクリプションページを表示し人々が加入できるようにする。",
"settings.general.faviconURL": "ファビコンURL",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "പുതിയ ആപ്പ് റിലീസുകൾക്കായി ഇടയ്ക്കിടെ പരിശോധിച്ച് അറിയിക്കുക.",
"settings.general.enablePublicArchive": "പൊതു മെയിലിംഗ് ലിസ്റ്റ് ആർക്കൈവ് പ്രവർത്തനക്ഷമമാക്കുക",
"settings.general.enablePublicArchiveHelp": "പൊതു വെബ്‌സൈറ്റിൽ ആർക്കൈവിംഗ് പ്രവർത്തനക്ഷമമാക്കിയ കാമ്പെയ്‌നുകൾ പ്രസിദ്ധീകരിക്കുക.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "പൊതു സബ്‌സ്‌ക്രിപ്‌ഷൻ താൾ പ്രവർത്തനക്ഷമമാക്കുക",
"settings.general.enablePublicSubPageHelp": "ആളുകൾക്ക് വരിക്കാരാകാനുള്ള എല്ലാ പൊതു ലിസ്റ്റുകളുമുള്ള പൊതുവായ ഒരു താൾ കാണിക്കുക.",
"settings.general.faviconURL": "ഫാവ് ഐക്കൺ യൂ. ആർ. എൽ",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Controleer regelmatig voor nieuwe app releases en verwittig.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Publieke inschrijvingspagina inschakelen.",
"settings.general.enablePublicSubPageHelp": "Laat een publieke inschrijvingspagina zien met alle publieke lijsten waarmee mensen zich kunnen inschrijven.",
"settings.general.faviconURL": "Favicon URL",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Regularnie sprawdzaj czy są aktualizacje i powiadamiaj o tym.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publikuj kampanie z włączoną archiwizacją na publicznej stronie",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Włącz publiczną stronę subskrypcji",
"settings.general.enablePublicSubPageHelp": "Pokaż publiczną stronę do zapisu na subskrypcje publicznych list.",
"settings.general.faviconURL": "URL Favicony",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Checar periodicamente por notificações e atualizações do app.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publicar campanhas nas quais o arquivamento está ativado no site público.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Habilitar a página pública de inscrição",
"settings.general.enablePublicSubPageHelp": "Habilitar a página pública de inscrição com todas as listas públicas para as pessoas se inscreverem.",
"settings.general.faviconURL": "URL do Favicon",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Procurar e notificar periodicamente por novas versões da aplicação.",
"settings.general.enablePublicArchive": "Ativar página de arquivo da lista de e-mail pública",
"settings.general.enablePublicArchiveHelp": "Publicar campanhas em que o arquivo está ligado no site público.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Ativar página de subscrição pública",
"settings.general.enablePublicSubPageHelp": "Mostrar uma página de subscrição pública com todas as listas públicas para as pessoas se subscreverem.",
"settings.general.faviconURL": "URL do Favicon",

View file

@ -378,6 +378,8 @@
"settings.general.checkUpdatesHelp": "Verifică periodic lansările de aplicații noi și notifică.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Activează pagina de abonament public",
"settings.general.enablePublicSubPageHelp": "Afișează o pagină de abonament publică cu toate listele publice pentru ca oamenii să se aboneze.",
"settings.general.faviconURL": "URL favicon",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Периодически проверяйте новые выпуски приложений и уведомляйте об этом.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Публиковать кампании с включённым архивированием на общедоступном сайте.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Включить публичную страницу подписки",
"settings.general.enablePublicSubPageHelp": "Показать страницу общедоступной подписки со всеми общедоступными списками, на которые можно подписаться.",
"settings.general.faviconURL": "URL-адрес фавикона",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Periodically check for new app releases and notify.",
"settings.general.enablePublicArchive": "Enable public mailing list archive",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Enable public subscription page",
"settings.general.enablePublicSubPageHelp": "Show a public subscription page with all the public lists for people to subscribe.",
"settings.general.faviconURL": "Favicon URL",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "Pravidelne kontrolovať nové vydání aplikácie a upozorniť.",
"settings.general.enablePublicArchive": "Zapnúť verejný archív",
"settings.general.enablePublicArchiveHelp": "Zverejniť kampane, pre ktoré je povolená archivácia na verejnej webstránke.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Povoliť verejnú stránku odberu",
"settings.general.enablePublicSubPageHelp": "Zobraziť verejnú stránku odberu so všetkými verejnými zoznamami pre ľudí k odberu.",
"settings.general.faviconURL": "URL adresa faviconu",

View file

@ -378,6 +378,8 @@
"settings.general.checkUpdatesHelp": "Yeni uygulama sürümlerini periyodik olarak kontrol edin ve bilgilendirin.",
"settings.general.enablePublicArchive": "Genel posta listesi arşiv sayfasını etkinleştirin",
"settings.general.enablePublicArchiveHelp": "Arşivlemenin etkinleştirildiği kampanyaları kamuya açık web sitesinde yayınlayın.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Erişime açık üyelik sayfasını etkinleştir",
"settings.general.enablePublicSubPageHelp": "Kişilerin abone olması için tüm genel listeleri içeren genel bir abonelik sayfası gösterin.",
"settings.general.faviconURL": "Favicon URL'si",

View file

@ -378,6 +378,8 @@
"settings.general.checkUpdatesHelp": "Kiểm tra định kỳ các bản phát hành ứng dụng mới và thông báo.",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "Bật trang đăng ký công khai",
"settings.general.enablePublicSubPageHelp": "Hiển thị trang đăng ký công khai với tất cả danh sách công khai để mọi người đăng ký.",
"settings.general.faviconURL": "Favicon URL",

View file

@ -377,6 +377,8 @@
"settings.general.checkUpdatesHelp": "定期检查新的应用程序版本并通知。",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "在公共网站上发布启用存档的活动。",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "启用公共订阅页面",
"settings.general.enablePublicSubPageHelp": "显示一个公共订阅页面,其中包含供人们订阅的所有公共列表。",
"settings.general.faviconURL": "网站图标网址",

View file

@ -378,6 +378,8 @@
"settings.general.checkUpdatesHelp": "定期檢查新的應用程序版本並通知。",
"settings.general.enablePublicArchive": "Enable public mailing list archive page",
"settings.general.enablePublicArchiveHelp": "Publish campaigns on which archiving is enabled on the public website.",
"settings.general.enablePublicArchiveRSSContent": "Show full content in RSS feed",
"settings.general.enablePublicArchiveRSSContentHelp": "Show full e-mail content in the RSS feed. If disabled, only the title and link elements are shown.",
"settings.general.enablePublicSubPage": "啟用公共訂閱頁面",
"settings.general.enablePublicSubPageHelp": "顯示一個公共訂閱頁面,其中包含供人們訂閱的所有公共列表。",
"settings.general.faviconURL": "網站圖標網址",

View file

@ -140,7 +140,7 @@ func (c *Core) GetCampaignForPreview(id, tplID int) (models.Campaign, error) {
// GetArchivedCampaigns retrieves campaigns with a template body.
func (c *Core) GetArchivedCampaigns(offset, limit int) (models.Campaigns, int, error) {
var out models.Campaigns
if err := c.q.GetArchivedCampaigns.Select(&out, offset, limit); err != nil {
if err := c.q.GetArchivedCampaigns.Select(&out, offset, limit, campaignTplArchive); err != nil {
c.log.Printf("error fetching public campaigns: %v", err)
return models.Campaigns{}, 0, echo.NewHTTPError(http.StatusInternalServerError,
c.i18n.Ts("globals.messages.errorFetching", "name", "{globals.terms.campaign}", "error", pqErrMsg(err)))

View file

@ -0,0 +1,21 @@
package migrations
import (
"github.com/jmoiron/sqlx"
"github.com/knadh/koanf"
"github.com/knadh/stuffbin"
)
// V2_5_0 performs the DB migrations.
func V2_5_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
// Insert new preference settings.
if _, err := db.Exec(`
INSERT INTO settings (key, value) VALUES
('app.enable_public_archive_rss_content', 'false')
ON CONFLICT DO NOTHING;
`); err != nil {
return err
}
return nil
}

View file

@ -2,17 +2,18 @@ package models
// Settings represents the app settings stored in the DB.
type Settings struct {
AppSiteName string `json:"app.site_name"`
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"`
EnablePublicArchive bool `json:"app.enable_public_archive"`
SendOptinConfirmation bool `json:"app.send_optin_confirmation"`
CheckUpdates bool `json:"app.check_updates"`
AppLang string `json:"app.lang"`
AppSiteName string `json:"app.site_name"`
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"`
EnablePublicArchive bool `json:"app.enable_public_archive"`
EnablePublicArchiveRSSContent bool `json:"app.enable_public_archive_rss_content"`
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"`

View file

@ -518,9 +518,15 @@ SELECT campaigns.*,
WHERE CASE WHEN $1 > 0 THEN campaigns.id = $1 ELSE uuid = $2 END;
-- name: get-archived-campaigns
SELECT COUNT(*) OVER () AS total, id, uuid, subject, archive_meta, created_at, send_at FROM campaigns
WHERE archive=true AND type='regular' AND status=ANY('{running, paused, finished}')
ORDER by created_at DESC OFFSET $1 LIMIT $2;
SELECT COUNT(*) OVER () AS total, campaigns.*,
COALESCE(templates.body, (SELECT body FROM templates WHERE is_default = true LIMIT 1)) AS template_body
FROM campaigns
LEFT JOIN templates ON (
CASE WHEN $3 = 'default' THEN templates.id = campaigns.template_id
ELSE templates.id = campaigns.archive_template_id END
)
WHERE campaigns.archive=true AND campaigns.type='regular' AND campaigns.status=ANY('{running, paused, finished}')
ORDER by campaigns.created_at DESC OFFSET $1 LIMIT $2;
-- name: get-campaign-stats
-- This query is used to lazy load campaign stats (views, counts, list of lists) given a list of campaign IDs.

View file

@ -196,6 +196,7 @@ INSERT INTO settings (key, value) VALUES
('app.message_sliding_window_rate', '10000'),
('app.enable_public_archive', 'true'),
('app.enable_public_subscription_page', 'true'),
('app.enable_public_archive_rss_content', 'true'),
('app.send_optin_confirmation', 'true'),
('app.check_updates', 'true'),
('app.notify_emails', '["admin1@mysite.com", "admin2@mysite.com"]'),