diff --git a/cmd/archive.go b/cmd/archive.go index 4605141..16e17ac 100644 --- a/cmd/archive.go +++ b/cmd/archive.go @@ -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 diff --git a/cmd/handlers.go b/cmd/handlers.go index ed93e68..adaec43 100644 --- a/cmd/handlers.go +++ b/cmd/handlers.go @@ -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")) diff --git a/cmd/init.go b/cmd/init.go index a9c355a..15837aa 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -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"` diff --git a/cmd/upgrade.go b/cmd/upgrade.go index 48f2bd3..97fdcee 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -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 diff --git a/frontend/src/views/settings/general.vue b/frontend/src/views/settings/general.vue index 8134014..2c9d10a 100644 --- a/frontend/src/views/settings/general.vue +++ b/frontend/src/views/settings/general.vue @@ -43,27 +43,45 @@
-
-
- - - + +
+

{{ $tc('globals.terms.subscriptions', 2) }}

+
+
+ + + +
+
+ + + +
-
- - - -
-
- - - +
+
+ +
+

{{ $t('campaigns.archive') }}

+
+
+ + + +
+
+ + + +
diff --git a/i18n/ca.json b/i18n/ca.json index 4219d7f..f056155 100644 --- a/i18n/ca.json +++ b/i18n/ca.json @@ -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", diff --git a/i18n/cs-cz.json b/i18n/cs-cz.json index 526336c..a805a29 100644 --- a/i18n/cs-cz.json +++ b/i18n/cs-cz.json @@ -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", diff --git a/i18n/cy.json b/i18n/cy.json index 9b9cebb..52c6abe 100644 --- a/i18n/cy.json +++ b/i18n/cy.json @@ -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", diff --git a/i18n/de.json b/i18n/de.json index 2d898c1..bf47f18 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -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", diff --git a/i18n/en.json b/i18n/en.json index 76760d8..05d2b96 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -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", diff --git a/i18n/es.json b/i18n/es.json index 4232a1f..946ac24 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -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", diff --git a/i18n/fi.json b/i18n/fi.json index 6306ab9..22a9dac 100644 --- a/i18n/fi.json +++ b/i18n/fi.json @@ -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", diff --git a/i18n/fr.json b/i18n/fr.json index b27731e..7d96ea9 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -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", diff --git a/i18n/hu.json b/i18n/hu.json index 438c489..9af95c8 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -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", diff --git a/i18n/it.json b/i18n/it.json index b0c89b1..19b534b 100644 --- a/i18n/it.json +++ b/i18n/it.json @@ -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", diff --git a/i18n/jp.json b/i18n/jp.json index 92e3acc..dc70244 100644 --- a/i18n/jp.json +++ b/i18n/jp.json @@ -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", diff --git a/i18n/ml.json b/i18n/ml.json index 0fff923..2d1e8f7 100644 --- a/i18n/ml.json +++ b/i18n/ml.json @@ -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": "ഫാവ് ഐക്കൺ യൂ. ആർ. എൽ", diff --git a/i18n/nl.json b/i18n/nl.json index dbed037..baacb5a 100644 --- a/i18n/nl.json +++ b/i18n/nl.json @@ -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", diff --git a/i18n/pl.json b/i18n/pl.json index 0dad2e6..218859e 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -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", diff --git a/i18n/pt-BR.json b/i18n/pt-BR.json index de0b7f4..2f46c98 100644 --- a/i18n/pt-BR.json +++ b/i18n/pt-BR.json @@ -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", diff --git a/i18n/pt.json b/i18n/pt.json index 9706c48..690db98 100644 --- a/i18n/pt.json +++ b/i18n/pt.json @@ -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", diff --git a/i18n/ro.json b/i18n/ro.json index 17d9668..fb35bc0 100644 --- a/i18n/ro.json +++ b/i18n/ro.json @@ -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", diff --git a/i18n/ru.json b/i18n/ru.json index 9369d19..52aa300 100644 --- a/i18n/ru.json +++ b/i18n/ru.json @@ -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-адрес фавикона", diff --git a/i18n/se.json b/i18n/se.json index 441ae6f..17e31b3 100644 --- a/i18n/se.json +++ b/i18n/se.json @@ -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", diff --git a/i18n/sk.json b/i18n/sk.json index 20abe7e..b2a1c95 100644 --- a/i18n/sk.json +++ b/i18n/sk.json @@ -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", diff --git a/i18n/tr.json b/i18n/tr.json index 79275e4..90e7e20 100644 --- a/i18n/tr.json +++ b/i18n/tr.json @@ -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", diff --git a/i18n/vi.json b/i18n/vi.json index 59679a9..a2baf66 100644 --- a/i18n/vi.json +++ b/i18n/vi.json @@ -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", diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json index 731ac1e..86f449e 100644 --- a/i18n/zh-CN.json +++ b/i18n/zh-CN.json @@ -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": "网站图标网址", diff --git a/i18n/zh-TW.json b/i18n/zh-TW.json index 31edc53..80aa418 100644 --- a/i18n/zh-TW.json +++ b/i18n/zh-TW.json @@ -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": "網站圖標網址", diff --git a/internal/core/campaigns.go b/internal/core/campaigns.go index c896a78..b14d461 100644 --- a/internal/core/campaigns.go +++ b/internal/core/campaigns.go @@ -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))) diff --git a/internal/migrations/v2.5.0.go b/internal/migrations/v2.5.0.go new file mode 100644 index 0000000..2c3562f --- /dev/null +++ b/internal/migrations/v2.5.0.go @@ -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 +} diff --git a/models/settings.go b/models/settings.go index 22ad4ef..99cd637 100644 --- a/models/settings.go +++ b/models/settings.go @@ -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"` diff --git a/queries.sql b/queries.sql index 731e4cf..196026d 100644 --- a/queries.sql +++ b/queries.sql @@ -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. diff --git a/schema.sql b/schema.sql index 18214fa..947bcd6 100644 --- a/schema.sql +++ b/schema.sql @@ -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"]'),