High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
JavaScript campaigncampaign-managementemail-marketingemail-subscriptionlistmonkmailing-listnewsletternewsletter-managementnewsletter-softwareself-hostedsms-gatewaysmtptransactional-emails
Add archival support to lists.
Kailash Nadh2074604512b3
diff --git a/cmd/install.go b/cmd/install.goindex 3199e4f8..ebe6da67 100644--- a/cmd/install.go+++ b/cmd/install.go@@ -142,6 +142,7 @@ func installLists(q *models.Queries) (int, int) {"Default list",models.ListTypePrivate,models.ListOptinSingle,+ models.ListStatusActive,pq.StringArray{"test"},"",); err != nil {@@ -152,6 +153,7 @@ func installLists(q *models.Queries) (int, int) {"Opt-in list",models.ListTypePublic,models.ListOptinDouble,+ models.ListStatusActive,pq.StringArray{"test"},"",); err != nil {diff --git a/cmd/lists.go b/cmd/lists.goindex a7ff9cdb..f7eddbbb 100644--- a/cmd/lists.go+++ b/cmd/lists.go@@ -21,7 +21,8 @@ func (a *App) GetLists(c echo.Context) error {// Minimal query simply returns the list of all lists without JOIN subscriber counts. This is fast.minimal, _ := strconv.ParseBool(c.FormValue("minimal"))if minimal {- res, err := a.core.GetLists("", hasAllPerm, permittedIDs)+ status := c.FormValue("status")+ res, err := a.core.GetLists("", status, hasAllPerm, permittedIDs)if err != nil {return err}@@ -48,11 +49,12 @@ func (a *App) GetLists(c echo.Context) error {orderBy = c.FormValue("order_by")typ = c.FormValue("type")optin = c.FormValue("optin")+ status = c.FormValue("status")order = c.FormValue("order")pg = a.pg.NewFromURL(c.Request().URL.Query()))- res, total, err := a.core.QueryLists(query, typ, optin, tags, orderBy, order, hasAllPerm, permittedIDs, pg.Offset, pg.Limit)+ res, total, err := a.core.QueryLists(query, typ, optin, status, tags, orderBy, order, hasAllPerm, permittedIDs, pg.Offset, pg.Limit)if err != nil {return err}diff --git a/cmd/public.go b/cmd/public.goindex 38db934c..7b76eab1 100644--- a/cmd/public.go+++ b/cmd/public.go@@ -122,7 +122,7 @@ func (t *tplRenderer) Render(w io.Writer, name string, data any, c echo.Context)// required to submit a subscription.func (a *App) GetPublicLists(c echo.Context) error {// Get all public lists.- lists, err := a.core.GetLists(models.ListTypePublic, true, nil)+ lists, err := a.core.GetLists(models.ListTypePublic, models.ListStatusActive, true, nil)if err != nil {return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("public.errorFetchingLists"))}@@ -417,7 +417,7 @@ func (a *App) SubscriptionFormPage(c echo.Context) error {}// Get all public lists from the DB.- lists, err := a.core.GetLists(models.ListTypePublic, true, nil)+ lists, err := a.core.GetLists(models.ListTypePublic, models.ListStatusActive, true, nil)if err != nil {return c.Render(http.StatusInternalServerError, tplMessage,makeMsgTpl(a.i18n.T("public.errorTitle"), "", a.i18n.Ts("public.errorFetchingLists")))diff --git a/docs/docs/content/apis/lists.md b/docs/docs/content/apis/lists.mdindex ff9e3032..77b35baa 100644--- a/docs/docs/content/apis/lists.md+++ b/docs/docs/content/apis/lists.md@@ -1,9 +1,9 @@# API / Lists| Method | Endpoint | Description |-|:-------|:------------------------------------------------|:--------------------------|+| :----- | :---------------------------------------------- | :------------------------ || GET | [/api/lists](#get-apilists) | Retrieve all lists. |-| GET | [/api/public/lists](#get-public-apilists) | Retrieve public lists.|+| GET | [/api/public/lists](#get-public-apilists) | Retrieve public lists. || GET | [/api/lists/{list_id}](#get-apilistslist_id) | Retrieve a specific list. || POST | [/api/lists](#post-apilists) | Create a new list. || PUT | [/api/lists/{list_id}](#put-apilistslist_id) | Update a list. |@@ -15,22 +15,32 @@ ______________________________________________________________________Retrieve lists.+> **Note:** Lists with `status: archived` are hidden from list selectors in campaigns, public subscription forms, and roles by default. They can only be viewed by filtering with `status=archived` or by viewing all lists without a status filter.+##### Parameters-| Name | Type | Required | Description |-|:---------|:---------|:---------|:-----------------------------------------------------------------|-| query | string | | string for list name search. |-| status | []string | | Status to filter lists. Repeat in the query for multiple values. |-| tag | []string | | Tags to filter lists. Repeat in the query for multiple values. |-| order_by | string | | Sort field. Options: name, status, created_at, updated_at. |-| order | string | | Sorting order. Options: ASC, DESC. |-| page | number | | Page number for pagination. |-| per_page | number | | Results per page. Set to 'all' to return all results. |+| Name | Type | Required | Description |+| :------- | :------- | :------- | :------------------------------------------------------------------------------------------------- |+| query | string | | String for list name search. |+| status | string | | Status to filter lists. Options: active, archived. Defaults to showing all lists if not specified. |+| minimal | boolean | | If true, returns lists without subscriber counts (faster). Defaults to false. |+| tag | []string | | Tags to filter lists. Repeat in the query for multiple values. |+| order_by | string | | Sort field. Options: name, status, created_at, updated_at. |+| order | string | | Sorting order. Options: ASC, DESC. |+| page | number | | Page number for pagination. |+| per_page | number | | Results per page. Set to 'all' to return all results. |##### Example Request```shell+# Get all listscurl -u "api_user:token" -X GET 'http://localhost:9000/api/lists?page=1&per_page=100'++# Get only active lists+curl -u "api_user:token" -X GET 'http://localhost:9000/api/lists?status=active&per_page=100'++# Get archived lists with minimal data+curl -u "api_user:token" -X GET 'http://localhost:9000/api/lists?status=archived&minimal=true&per_page=all'```##### Example Response@@ -47,6 +57,7 @@ curl -u "api_user:token" -X GET 'http://localhost:9000/api/lists?page=1&per_page"name": "Default list","type": "public","optin": "double",+ "status": "active","tags": ["test"],@@ -60,6 +71,7 @@ curl -u "api_user:token" -X GET 'http://localhost:9000/api/lists?page=1&per_page"name": "get","type": "private","optin": "single",+ "status": "active","tags": [],"subscriber_count": 0}@@ -77,6 +89,8 @@ ______________________________________________________________________Retrieve public lists with name and uuid to submit a subscription. This is an unauthenticated call to enable scripting to subscription form.+> **Note:** This endpoint only returns lists with `type: public` and `status: active`. Archived lists are never shown on public subscription forms.+##### Example Request```shell@@ -101,9 +115,9 @@ Retrieve a specific list.##### Parameters-| Name | Type | Required | Description |-|:--------|:----------|:---------|:----------------------------|-| list_id | number | Yes | ID of the list to retrieve. |+| Name | Type | Required | Description |+| :------ | :----- | :------- | :-------------------------- |+| list_id | number | Yes | ID of the list to retrieve. |##### Example Request@@ -123,6 +137,7 @@ curl -u "api_user:token" -X GET 'http://localhost:9000/api/lists/5'"name": "Test list","type": "public","optin": "double",+ "status": "active","tags": [],"subscriber_count": 0}@@ -137,13 +152,14 @@ Create a new list.##### Parameters-| Name | Type | Required | Description |-|:------|:----------|:---------|:----------------------------------------|-| name | string | Yes | Name of the new list. |-| type | string | Yes | Type of list. Options: private, public. |-| optin | string | Yes | Opt-in type. Options: single, double. |-| tags | string\[\] | | Associated tags for a list. |-| description | string | No | Description of the new list. |+| Name | Type | Required | Description |+| :---------- | :--------- | :------- | :----------------------------------------------------------------- |+| name | string | Yes | Name of the new list. |+| type | string | Yes | Type of list. Options: private, public. |+| optin | string | Yes | Opt-in type. Options: single, double. |+| status | string | No | Status of the list. Options: active, archived. Defaults to active. |+| tags | string\[\] | | Associated tags for a list. |+| description | string | No | Description of the new list. |##### Example Request@@ -162,12 +178,13 @@ curl -u "api_user:token" -X POST 'http://localhost:9000/api/lists'"uuid": "1bb246ab-7417-4cef-bddc-8fc8fc941d3a","name": "Test list","type": "public",+ "optin": "single",+ "status": "active","tags": [],"subscriber_count": 0,"description": "This is a test list"}}-null```______________________________________________________________________@@ -178,14 +195,15 @@ Update a list.##### Parameters-| Name | Type | Required | Description |-|:--------|:----------|:---------|:----------------------------------------|-| list_id | number | Yes | ID of the list to update. |-| name | string | | New name for the list. |-| type | string | | Type of list. Options: private, public. |-| optin | string | | Opt-in type. Options: single, double. |-| tags | string\[\] | | Associated tags for the list. |-| description | string | | Description of the new list. |+| Name | Type | Required | Description |+| :---------- | :--------- | :------- | :--------------------------------------------- |+| list_id | number | Yes | ID of the list to update. |+| name | string | | New name for the list. |+| type | string | | Type of list. Options: private, public. |+| optin | string | | Opt-in type. Options: single, double. |+| status | string | | Status of the list. Options: active, archived. |+| tags | string\[\] | | Associated tags for the list. |+| description | string | | Description of the list. |##### Example Request@@ -207,6 +225,7 @@ curl -u "api_user:token" -X PUT 'http://localhost:9000/api/lists/5' \"name": "modified test list","type": "private","optin": "single",+ "status": "active","tags": [],"subscriber_count": 0,"description": "This is a test list"@@ -222,9 +241,9 @@ Delete a specific list.##### Parameters-| Name | Type | Required | Description |-|:--------|:----------|:---------|:--------------------------|-| list_id | Number | Yes | ID of the list to delete. |+| Name | Type | Required | Description |+| :------ | :----- | :------- | :------------------------ |+| list_id | Number | Yes | ID of the list to delete. |##### Example Requestdiff --git a/frontend/src/App.vue b/frontend/src/App.vueindex 27169ace..b03b87de 100644--- a/frontend/src/App.vue+++ b/frontend/src/App.vue@@ -191,8 +191,8 @@ export default Vue.extend({return (this.serverConfig.needs_restart|| this.serverConfig.has_legacy_user|| (this.serverConfig.update- && this.serverConfig.update.messages- && this.serverConfig.update.messages.length > 0));+ && this.serverConfig.update.messages+ && this.serverConfig.update.messages.length > 0));},version() {@@ -207,7 +207,7 @@ export default Vue.extend({mounted() {// Lists is required across different views. On app load, fetch the lists// and have them in the store.- this.$api.getLists({ minimal: true, per_page: 'all' });+ this.$api.getLists({ minimal: true, per_page: 'all', status: 'active' });window.addEventListener('resize', () => {this.windowWidth = window.innerWidth;diff --git a/frontend/src/views/ListForm.vue b/frontend/src/views/ListForm.vueindex 27fa5aa1..3b960406 100644--- a/frontend/src/views/ListForm.vue+++ b/frontend/src/views/ListForm.vue@@ -53,6 +53,10 @@<b-input :maxlength="2000" v-model="form.description" name="description" type="textarea":placeholder="$t('globals.fields.description')" /></b-field>++ <b-field :message="$t('lists.archivedHelp')" :label="$t('lists.archived')">+ <b-switch v-model="isArchived" name="status" />+ </b-field></section><footer class="modal-card-foot has-text-right"><b-button @click="$parent.close()">@@ -91,6 +95,7 @@ export default Vue.extend({name: '',type: 'private',optin: 'single',+ status: 'active',tags: [],},};@@ -125,6 +130,15 @@ export default Vue.extend({computed: {...mapState(['loading', 'profile']),++ isArchived: {+ get() {+ return this.form.status === 'archived';+ },+ set(v) {+ this.form.status = v ? 'archived' : 'active';+ },+ },},mounted() {diff --git a/frontend/src/views/Lists.vue b/frontend/src/views/Lists.vueindex 92e8b1cc..2800d3b4 100644--- a/frontend/src/views/Lists.vue+++ b/frontend/src/views/Lists.vue@@ -2,10 +2,20 @@<section class="lists"><header class="columns page-header"><div class="column is-10">- <h1 class="title is-4">+ <h1 class="title is-4 mb-2">{{ $t('globals.terms.lists') }}+ <span v-if="queryParams.status === 'archived'" class="has-text-grey-light">/ {{ queryParams.status }} </span><span v-if="!isNaN(lists.total)">({{ lists.total }})</span></h1>++ <div class="is-size-7">+ <router-link v-if="queryParams.status !== 'archived'" :to="{ name: 'lists', query: { status: 'archived' } }">+ {{ $t('globals.buttons.view') }} {{ $t('lists.archived').toLowerCase() }} →+ </router-link>+ <router-link v-else :to="{ name: 'lists' }">+ {{ $t('globals.buttons.view') }} {{ $t('menu.allLists').toLowerCase() }} →+ </router-link>+ </div></div><div class="column has-text-right"><b-field v-if="$can('lists:manage_all')" expanded>@@ -23,15 +33,12 @@<div class="columns"><div class="column is-6"><form @submit.prevent="getLists">- <div>- <b-field>- <b-input v-model="queryParams.query" name="query" expanded icon="magnify" ref="query"- data-cy="query" />- <p class="controls">- <b-button native-type="submit" type="is-primary" icon-left="magnify" data-cy="btn-query" />- </p>- </b-field>- </div>+ <b-field>+ <b-input v-model="queryParams.query" name="query" expanded icon="magnify" ref="query" data-cy="query" />+ <p class="controls">+ <b-button native-type="submit" type="is-primary" icon-left="magnify" data-cy="btn-query" />+ </p>+ </b-field></form></div></div>@@ -186,6 +193,7 @@ export default Vue.extend({query: '',orderBy: 'id',order: 'asc',+ status: this.$route.query.status || 'active',},};},@@ -241,13 +249,14 @@ export default Vue.extend({query: this.queryParams.query.replace(/[^\p{L}\p{N}\s]/gu, ' '),order_by: this.queryParams.orderBy,order: this.queryParams.order,+ status: this.queryParams.status,}).then((resp) => {this.lists = resp;});// Also fetch the minimal lists for the global store that appears// in dropdown menus on other pages like import and campaigns.- this.$api.getLists({ minimal: true, per_page: 'all' });+ this.$api.getLists({ minimal: true, per_page: 'all', status: 'active' });},deleteList(list) {diff --git a/i18n/bg.json b/i18n/bg.jsonindex a865edb9..413ee023 100644--- a/i18n/bg.json+++ b/i18n/bg.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Презаписването ще абонира отново отписаните имейли. Продължавате ли?","import.title": "Импортиране на абонати","import.upload": "Качване",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Сигурни ли сте? Това не изтрива абонатите.","lists.confirmSub": "Потвърждаване на абонамент(и) за {name}","lists.invalidName": "Невалидно име",diff --git a/i18n/ca.json b/i18n/ca.jsonindex 705c2867..c15be2de 100644--- a/i18n/ca.json+++ b/i18n/ca.json@@ -282,6 +282,8 @@"import.subscribeWarning": "La sobrescriptura tornarà a subscriure els correus electrònics desubscrits. Vols continuar?","import.title": "Importa subscriptors","import.upload": "Carrega",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Estàs segur? Això no elimina els subscriptors.","lists.confirmSub": "Confirmeu les subscripcions a {name}","lists.invalidName": "Nom no vàlid",diff --git a/i18n/cs-cz.json b/i18n/cs-cz.jsonindex 929126ea..0002d350 100644--- a/i18n/cs-cz.json+++ b/i18n/cs-cz.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Přepsání znovu přihlásí odhlášené adresy. Pokračovat?","import.title": "Importovat odběratele","import.upload": "Odeslat",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Jste si jisti? Tímto se neodstraní odběratelé.","lists.confirmSub": "Potvrdit odběr(y) pro {name}","lists.invalidName": "Neplatné jméno",diff --git a/i18n/cy.json b/i18n/cy.jsonindex 0c5d2979..b173b880 100644--- a/i18n/cy.json+++ b/i18n/cy.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Bydd troi'n ôl yn adysgrifio negeseuon e-bost wedi'u hallgofrestru. Cofiwch?","import.title": "Mewngludo tanysgrifwyr","import.upload": "Llwytho i fyny",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Ydych chi'n siŵr? Nid yw hyn yn dileu tanysgrifwyr.","lists.confirmSub": "Cadarnhau tanysgrifiad i {name}","lists.invalidName": "Enw annilys",diff --git a/i18n/da.json b/i18n/da.jsonindex a33c4c99..aaef55d0 100644--- a/i18n/da.json+++ b/i18n/da.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Overskrivning vil tilmelde afmeldte e-mails igen. Vil du fortsætte?","import.title": "Importer abonnenter","import.upload": "Upload",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Er du sikker? Dette sletter ikke abonnenter.","lists.confirmSub": "Bekræft abonnement(er) på {name}","lists.invalidName": "Ugyldigt navn",diff --git a/i18n/de.json b/i18n/de.jsonindex 0e726496..1a581345 100644--- a/i18n/de.json+++ b/i18n/de.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Das Überschreiben führt zur erneuten Anmeldung von abgemeldeten E-Mails. Fortfahren?","import.title": "Abonnenten importieren","import.upload": "Hochladen",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Bist du sicher? Das Löschen einer Liste löscht keine Abonnenten.","lists.confirmSub": "Bestätige das/die Abonnement/s von {name}","lists.invalidName": "Ungültiger Name",diff --git a/i18n/el.json b/i18n/el.jsonindex cb565f51..ebb3a438 100644--- a/i18n/el.json+++ b/i18n/el.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Η αντικατάσταση θα επανεγγράψει τα μη συνδρομημένα e-mail. Να συνεχίσω;","import.title": "Εισαγωγή συνδρομητών","import.upload": "Μεταφόρτωση",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Σίγουρα; Αυτό δεν διαγράφει τους συνδρομητές.","lists.confirmSub": "Επιβεβαίωση εγγραφής(-ών) στο {name}","lists.invalidName": "Μη έγκυρο όνομα",diff --git a/i18n/en.json b/i18n/en.jsonindex 9e836bf0..2eedf463 100644--- a/i18n/en.json+++ b/i18n/en.json@@ -682,5 +682,7 @@"users.totpCodeHelp": "Enter the 6-digit code from your authenticator app","users.totpScanQR": "Scan the QR code with your authenticator app such as Ente or Google Authenticator and enter the TOTP code below.","users.totpSecret": "Secret key",- "users.invalidPassword": "Invalid password"+ "users.invalidPassword": "Invalid password",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists."}diff --git a/i18n/eo.json b/i18n/eo.jsonindex bb4b38f7..48fbe049 100644--- a/i18n/eo.json+++ b/i18n/eo.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Ĉi tio forigos abonitajn retadresojn. Ĉu daŭrigi?","import.title": "Importa subscriptors","import.upload": "Carrega",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Estàs segur? Això no elimina els subscriptors.","lists.confirmSub": "Confirmeu les subscripcions a {name}","lists.invalidName": "Nom no vàlid",diff --git a/i18n/es.json b/i18n/es.jsonindex 022eb67c..e4abffed 100644--- a/i18n/es.json+++ b/i18n/es.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Sobrescribirá las direcciones de correo electrónico que están canceladas. ¿Desea continuar?","import.title": "Importar suscriptores","import.upload": "Cargar",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "¿Está seguro? Esto no elimina suscriptores","lists.confirmSub": "Suscripción confirmada a {name}","lists.invalidName": "Nombre inválido",diff --git a/i18n/fi.json b/i18n/fi.jsonindex 4c612d89..57fbaebb 100644--- a/i18n/fi.json+++ b/i18n/fi.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Ylikirjoitus liittää perutut sähköpostiosoitteet uudelleen. Haluatko jatkaa?","import.title": "Tuo tilaajat","import.upload": "Lataa",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Oletko varma? Tämä ei poista tilaajia.","lists.confirmSub": "Vahvista liittyminen ({name})","lists.invalidName": "Virheellinen nimi",diff --git a/i18n/fr-CA.json b/i18n/fr-CA.jsonindex e5c78efa..93847e92 100644--- a/i18n/fr-CA.json+++ b/i18n/fr-CA.json@@ -282,6 +282,8 @@"import.subscribeWarning": "La réinscription écrasera les e-mails désinscrits. Continuer ?","import.title": "Importer des abonné·es","import.upload": "Envoyer",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Êtes-vous sûr·e de supprimer cette liste ? Cela ne supprimera pas les abonné·es.","lists.confirmSub": "Confirmer les abonnements à {name}","lists.invalidName": "Nom incorrect",diff --git a/i18n/fr.json b/i18n/fr.jsonindex 63d9d996..64ef8bfc 100644--- a/i18n/fr.json+++ b/i18n/fr.json@@ -282,6 +282,8 @@"import.subscribeWarning": "La réinscription écrasera les e-mails désabonnés. Continuer ?","import.title": "Importer des abonné·es","import.upload": "Envoyer",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Êtes-vous sûr·e de supprimer cette liste ? Cela ne supprimera pas les abonné·es.","lists.confirmSub": "Confirmer les abonnements à {name}","lists.invalidName": "Nom incorrect",diff --git a/i18n/he.json b/i18n/he.jsonindex 062e18e9..de33f81e 100644--- a/i18n/he.json+++ b/i18n/he.json@@ -282,6 +282,8 @@"import.subscribeWarning": "שגר את עורך למערכת והרשם שוב לעיתוי כתובת אימייל שבוטלה. האם להמשיך?","import.title": "ייבוא מנויים","import.upload": "העלאה",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "האם אתה בטוח? זה לא מוחק את המנויים.","lists.confirmSub": "אשר את המנויים עבור {name}","lists.invalidName": "שם לא חוקי",diff --git a/i18n/hu.json b/i18n/hu.jsonindex 425abf2f..9a1e6aa5 100644--- a/i18n/hu.json+++ b/i18n/hu.json@@ -282,6 +282,8 @@"import.subscribeWarning": "A felülírás feliratkozatlan e-maileket újra fel fog iratkoztatni. Folytatja?","import.title": "Tagok importálása","import.upload": "Feltöltés",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Biztos? Ez nem törli a tagokat.","lists.confirmSub": "Tagság megerősítése: {name}","lists.invalidName": "Érvénytelen név",diff --git a/i18n/it.json b/i18n/it.jsonindex 1471140e..d25374f2 100644--- a/i18n/it.json+++ b/i18n/it.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Sovrascrivere sottoscriverà nuovamente gli indirizzi email non sottoscritti. Continuare?","import.title": "Importare iscritti","import.upload": "Caricare",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Sei sicuro? Questo non cancella gli iscritti","lists.confirmSub": "Confermare gli iscritti di {name}","lists.invalidName": "Nome errato",diff --git a/i18n/jp.json b/i18n/jp.jsonindex 620a24b1..c9d4040c 100644--- a/i18n/jp.json+++ b/i18n/jp.json@@ -282,6 +282,8 @@"import.subscribeWarning": "上書きすると、登録解除されたメールアドレスが再登録されます。続行しますか?","import.title": "加入者をインポート","import.upload": "アップロード",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "本当に良いですか?これは加入者を削除しません。","lists.confirmSub": "{name}にサブスクリプション確認","lists.invalidName": "無効な名前",diff --git a/i18n/ko.json b/i18n/ko.jsonindex b6fb70b7..f58f7280 100644--- a/i18n/ko.json+++ b/i18n/ko.json@@ -282,6 +282,8 @@"import.subscribeWarning": "덮어쓰면 구독 해지된 이메일이 다시 구독됩니다. 계속하시겠습니까?","import.title": "구독자 가져오기","import.upload": "업로드",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "정말 삭제하시겠습니까? 구독자는 삭제되지 않습니다.","lists.confirmSub": "{name} 구독 확인","lists.invalidName": "잘못된 이름",diff --git a/i18n/ml.json b/i18n/ml.jsonindex 9f156d82..b3296a44 100644--- a/i18n/ml.json+++ b/i18n/ml.json@@ -282,6 +282,8 @@"import.subscribeWarning": "പുനര്വൃത്തിപ്പെടുന്ന അസഭ്യ ഇ-മെയിലുകള് പുനര്വൃത്തിപ്പെടുത്തുന്നു. തുല്യമാക്കുക?","import.title": "വരിക്കാരേ ഇംപോർട്ട് ചെയ്യുക","import.upload": "അപ്ലോഡ്",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "നിങ്ങൾക്ക് തീർച്ചയാണോ? ഇത് ലിസ്റ്റിലെ വരിക്കാരെ ഇല്ലാതാക്കില്ല.","lists.confirmSub": "{name} ൽ വരിക്കാരനാകുന്നത് സ്ഥിരീകരിക്കുക","lists.invalidName": "പേര് അസാധുവാണ്",diff --git a/i18n/nl.json b/i18n/nl.jsonindex d1330f8f..c1512525 100644--- a/i18n/nl.json+++ b/i18n/nl.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Bij overschrijven kunnen abonnees die zich hebben afgemeld weer worden ingeschreven. Doorgaan?","import.title": "Abonnees importeren","import.upload": "Opladen",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Bent u zeker? Dit verwijdert niet alle abonnees.","lists.confirmSub": "Bevestig de inschrijving(en) voor {name}","lists.invalidName": "Ongeldige naam",diff --git a/i18n/no.json b/i18n/no.jsonindex deb6583b..e16432da 100644--- a/i18n/no.json+++ b/i18n/no.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Overskriving vil re-abonnere avmeldte e-poster. Fortsette?","import.title": "Importer abonnenter","import.upload": "Last opp",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Er du sikker? Dette sletter ikke abonnenter.","lists.confirmSub": "Bekreft abonnement på {name}","lists.invalidName": "Ugyldig navn",diff --git a/i18n/pl.json b/i18n/pl.jsonindex b156352a..7d542c90 100644--- a/i18n/pl.json+++ b/i18n/pl.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Nadpisanie spowoduje ponowne zasubskrybowanie emaili, które zostały zrezygnowane z subskrypcji. Kontynuować?","import.title": "Importuj subskrypcje","import.upload": "Wyślij",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Jesteś pewny(a)? To nie usunie subskrybcji.","lists.confirmSub": "Potwierdź subskrypcję dla {name}","lists.invalidName": "Nieprawidłowa nazwa",diff --git a/i18n/pt-BR.json b/i18n/pt-BR.jsonindex 320b1ce0..98a4c186 100644--- a/i18n/pt-BR.json+++ b/i18n/pt-BR.json@@ -282,6 +282,8 @@"import.subscribeWarning": "A sobrescrita irá resscrever e-mails que foram cancelados a assinatura. Continuar?","import.title": "Importar inscritos","import.upload": "Enviar arquivo",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Você tem certeza? Isso não exclui inscritos.","lists.confirmSub": "Confirmar assinatura(s) para {name}","lists.invalidName": "Nome inválido",diff --git a/i18n/pt.json b/i18n/pt.jsonindex e9a1cd65..674cf8b2 100644--- a/i18n/pt.json+++ b/i18n/pt.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Sobrescreverá e-mails cancelados. Deseja continuar?","import.title": "Importar subscritores","import.upload": "Carregar",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Tens a certeza? Isto não elimina subscritores.","lists.confirmSub": "Confirmar subscrição(ões) para {name}","lists.invalidName": "Nome inválido",diff --git a/i18n/ro.json b/i18n/ro.jsonindex a6e65974..dfc87a1f 100644--- a/i18n/ro.json+++ b/i18n/ro.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Suprascrierea va rescrie e-mailurile care au fost dezabonate. Continuați?","import.title": "Importați abonații","import.upload": "Încarcă",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Eşti sigur? Acest lucru nu șterge abonații.","lists.confirmSub": "Confirmați abonamentul (abonamentele) la {name}","lists.invalidName": "Nume nevalid",diff --git a/i18n/ru.json b/i18n/ru.jsonindex 5e781066..ef3f17e4 100644--- a/i18n/ru.json+++ b/i18n/ru.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Перезапись приведёт к повторной подписке отписавшихся адресов. Продолжить?","import.title": "Импорт подписчиков","import.upload": "Загрузить",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Вы уверены? Это не удалит подписчиков.","lists.confirmSub": "Подтвердить подписку на {name}","lists.invalidName": "Неверное имя",diff --git a/i18n/se.json b/i18n/se.jsonindex 295b8970..418075bc 100644--- a/i18n/se.json+++ b/i18n/se.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Överstyrning kommer att återprenumerera på avregistrerade e-postmeddelanden. Fortsätta?","import.title": "Importera prenumeranter","import.upload": "Ladda upp",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Är du säker? Detta tar inte bort prenumeranter.","lists.confirmSub": "Bekräfta prenumeration(er) till {name}","lists.invalidName": "Ogiltigt namn",diff --git a/i18n/sk.json b/i18n/sk.jsonindex 821c9f7c..2a615d3d 100644--- a/i18n/sk.json+++ b/i18n/sk.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Prepísanie povedie k opätovnej prihláseniu odhlásených e-mailov. Pokračovať?","import.title": "Importodberateľov","import.upload": "Nahrať",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Ste si isti? Týmto sa neodstránia odberatelia.","lists.confirmSub": "Potvrdiť odber(y) pre {name}","lists.invalidName": "Neplatné meno",diff --git a/i18n/sl.json b/i18n/sl.jsonindex 72a4ed52..aa5c1cae 100644--- a/i18n/sl.json+++ b/i18n/sl.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Prepis bo ponovno naročil odjavljene e-pošte. Želite nadaljevati?","import.title": "Uvozi naročnike","import.upload": "Naloži",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Ste prepričani? To ne izbriše naročnikov.","lists.confirmSub": "Potrdi naročnino(e) na {name}","lists.invalidName": "Neveljavno ime",diff --git a/i18n/tr.json b/i18n/tr.jsonindex 0f3ac123..ddc7c64f 100644--- a/i18n/tr.json+++ b/i18n/tr.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Üzerine yazma, aboneliği iptal edilen e-postaları yeniden abone yapacak. Devam etmek istiyor musunuz?","import.title": "Üyeleri içeri aktar","import.upload": "Yükle",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Emin misiniz? Bu işlem üyeleri silmeyecek.","lists.confirmSub": "{name} için üyelik(leri) doğrula","lists.invalidName": "Yanlış isim",diff --git a/i18n/uk.json b/i18n/uk.jsonindex d5dcd74a..a33ea222 100644--- a/i18n/uk.json+++ b/i18n/uk.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Перезаписання призведе до повторного підпису невідписаних електронних адрес. Продовжити?","import.title": "Імпортувати підписни_ць","import.upload": "Вивантажити",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Точно? Це не видалить підписни_ць.","lists.confirmSub": "Підтвердити підписку на {name}","lists.invalidName": "Хибна назва",diff --git a/i18n/vi.json b/i18n/vi.jsonindex 8b108d13..b050253d 100644--- a/i18n/vi.json+++ b/i18n/vi.json@@ -282,6 +282,8 @@"import.subscribeWarning": "Ghi đè sẽ đăng ký lại các email đã hủy đăng ký. Tiếp tục?","import.title": "Nhập người đăng ký","import.upload": "Tải lên",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "Bạn có chắc không? Điều này không xóa người đăng ký.","lists.confirmSub": "Xác nhận (các) đăng ký với {name}","lists.invalidName": "Tên không hợp lệ",diff --git a/i18n/zh-CN.json b/i18n/zh-CN.jsonindex a9e05999..2eb82b09 100644--- a/i18n/zh-CN.json+++ b/i18n/zh-CN.json@@ -282,6 +282,8 @@"import.subscribeWarning": "覆盖将重新订阅已取消订阅的电子邮件。是否继续?","import.title": "导入订阅者","import.upload": "上传",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "你确定吗?这不会删除订阅者。","lists.confirmSub": "确认订阅 {name}","lists.invalidName": "名称无效",diff --git a/i18n/zh-TW.json b/i18n/zh-TW.jsonindex 5ef84094..61a05cdc 100644--- a/i18n/zh-TW.json+++ b/i18n/zh-TW.json@@ -282,6 +282,8 @@"import.subscribeWarning": "覆寫將重新訂閱已取消訂閱的電子郵件。繼續嗎?","import.title": "匯入訂閱者","import.upload": "上傳",+ "lists.archived": "Archived",+ "lists.archivedHelp": "Archiving hides the lists from lists page, campaigns, and public forms. It can be unarchived anytime. It is useful for hiding old and rarely used lists.","lists.confirmDelete": "你確定嗎?這不會刪除訂閱者。","lists.confirmSub": "確認訂閱{name}","lists.invalidName": "名稱無效",diff --git a/internal/core/lists.go b/internal/core/lists.goindex b3b94001..1c2d3d04 100644--- a/internal/core/lists.go+++ b/internal/core/lists.go@@ -15,11 +15,11 @@ type listType struct {Type string `json:"type"`}-// GetLists gets all lists optionally filtered by type.-func (c *Core) GetLists(typ string, getAll bool, permittedIDs []int) ([]models.List, error) {+// GetLists gets all lists optionally filtered by type and status.+func (c *Core) GetLists(typ, status string, getAll bool, permittedIDs []int) ([]models.List, error) {out := []models.List{}- if err := c.q.GetLists.Select(&out, typ, "id", getAll, pq.Array(permittedIDs)); err != nil {+ if err := c.q.GetLists.Select(&out, typ, status, "id", getAll, pq.Array(permittedIDs)); err != nil {c.log.Printf("error fetching lists: %v", err)return nil, echo.NewHTTPError(http.StatusInternalServerError,c.i18n.Ts("globals.messages.errorFetching", "name", "{globals.terms.lists}", "error", pqErrMsg(err)))@@ -42,7 +42,7 @@ func (c *Core) GetLists(typ string, getAll bool, permittedIDs []int) ([]models.L// QueryLists gets multiple lists based on multiple query params. Along with the paginated and sliced// results, the total number of lists in the DB is returned.-func (c *Core) QueryLists(searchStr, typ, optin string, tags []string, orderBy, order string, getAll bool, permittedIDs []int, offset, limit int) ([]models.List, int, error) {+func (c *Core) QueryLists(searchStr, typ, optin, status string, tags []string, orderBy, order string, getAll bool, permittedIDs []int, offset, limit int) ([]models.List, int, error) {_ = c.refreshCache(matListSubStats, false)if tags == nil {@@ -53,7 +53,7 @@ func (c *Core) QueryLists(searchStr, typ, optin string, tags []string, orderBy,out = []models.List{}queryStr, stmt = makeSearchQuery(searchStr, orderBy, order, c.q.QueryLists, listQuerySortFields))- if err := c.db.Select(&out, stmt, 0, "", queryStr, typ, optin, pq.StringArray(tags), getAll, pq.Array(permittedIDs), offset, limit); err != nil {+ if err := c.db.Select(&out, stmt, 0, "", queryStr, typ, optin, status, pq.StringArray(tags), getAll, pq.Array(permittedIDs), offset, limit); err != nil {c.log.Printf("error fetching lists: %v", err)return nil, 0, echo.NewHTTPError(http.StatusInternalServerError,c.i18n.Ts("globals.messages.errorFetching", "name", "{globals.terms.lists}", "error", pqErrMsg(err)))@@ -83,7 +83,7 @@ func (c *Core) GetList(id int, uuid string) (models.List, error) {var res []models.ListqueryStr, stmt := makeSearchQuery("", "", "", c.q.QueryLists, nil)- if err := c.db.Select(&res, stmt, id, uu, queryStr, "", "", pq.StringArray{}, true, nil, 0, 1); err != nil {+ if err := c.db.Select(&res, stmt, id, uu, queryStr, "", "", "", pq.StringArray{}, true, nil, 0, 1); err != nil {c.log.Printf("error fetching lists: %v", err)return models.List{}, echo.NewHTTPError(http.StatusInternalServerError,c.i18n.Ts("globals.messages.errorFetching", "name", "{globals.terms.lists}", "error", pqErrMsg(err)))@@ -160,11 +160,14 @@ func (c *Core) CreateList(l models.List) (models.List, error) {if l.Optin == "" {l.Optin = models.ListOptinSingle}+ if l.Status == "" {+ l.Status = models.ListStatusActive+ }// Insert and read ID.var newID intl.UUID = uu.String()- if err := c.q.CreateList.Get(&newID, l.UUID, l.Name, l.Type, l.Optin, pq.StringArray(normalizeTags(l.Tags)), l.Description); err != nil {+ if err := c.q.CreateList.Get(&newID, l.UUID, l.Name, l.Type, l.Optin, l.Status, pq.StringArray(normalizeTags(l.Tags)), l.Description); err != nil {c.log.Printf("error creating list: %v", err)return models.List{}, echo.NewHTTPError(http.StatusInternalServerError,c.i18n.Ts("globals.messages.errorCreating", "name", "{globals.terms.list}", "error", pqErrMsg(err)))@@ -175,7 +178,7 @@ func (c *Core) CreateList(l models.List) (models.List, error) {// UpdateList updates a given list.func (c *Core) UpdateList(id int, l models.List) (models.List, error) {- res, err := c.q.UpdateList.Exec(id, l.Name, l.Type, l.Optin, pq.StringArray(normalizeTags(l.Tags)), l.Description)+ res, err := c.q.UpdateList.Exec(id, l.Name, l.Type, l.Optin, l.Status, pq.StringArray(normalizeTags(l.Tags)), l.Description)if err != nil {c.log.Printf("error updating list: %v", err)return models.List{}, echo.NewHTTPError(http.StatusInternalServerError,diff --git a/internal/migrations/v5.2.0.go b/internal/migrations/v5.2.0.goindex 02e733ad..4e7465cf 100644--- a/internal/migrations/v5.2.0.go+++ b/internal/migrations/v5.2.0.go@@ -32,5 +32,21 @@ func V5_2_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf, lo *log.Loggerreturn err}+ // Add status field to lists table.+ _, err = db.Exec(`+ DO $$ BEGIN+ -- Create list_status enum if it doesn't exist+ IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'list_status') THEN+ CREATE TYPE list_status AS ENUM ('active', 'archived');+ END IF;+ END $$;++ ALTER TABLE lists ADD COLUMN IF NOT EXISTS status list_status NOT NULL DEFAULT 'active';+ CREATE INDEX IF NOT EXISTS idx_lists_status ON lists(status);+ `)+ if err != nil {+ return err+ }+return nil}diff --git a/models/lists.go b/models/lists.goindex d9c8e2fc..486a1eac 100644--- a/models/lists.go+++ b/models/lists.go@@ -6,10 +6,12 @@ import ()const (- ListTypePrivate = "private"- ListTypePublic = "public"- ListOptinSingle = "single"- ListOptinDouble = "double"+ ListTypePrivate = "private"+ ListTypePublic = "public"+ ListOptinSingle = "single"+ ListOptinDouble = "double"+ ListStatusActive = "active"+ ListStatusArchived = "archived")// List represents a mailing list.@@ -20,6 +22,7 @@ type List struct {Name string `db:"name" json:"name"`Type string `db:"type" json:"type"`Optin string `db:"optin" json:"optin"`+ Status string `db:"status" json:"status"`Tags pq.StringArray `db:"tags" json:"tags"`Description string `db:"description" json:"description"`SubscriberCount int `db:"subscriber_count" json:"subscriber_count"`diff --git a/queries/campaigns.sql b/queries/campaigns.sqlindex d3feec3f..835a700c 100644--- a/queries/campaigns.sql+++ b/queries/campaigns.sql@@ -282,7 +282,7 @@ SELECT campaigns.id AS campaign_id, campaigns.type as campaign_type, last_subscrFROM campaignsLEFT JOIN campaign_lists ON (campaign_lists.campaign_id = campaigns.id)LEFT JOIN lists ON (lists.id = campaign_lists.list_id)- WHERE campaigns.id = $1 AND status='running';+ WHERE campaigns.id = $1 AND campaigns.status='running';-- name: next-campaign-subscribers-- Returns a batch of subscribers in a given campaign starting from the last checkpointdiff --git a/queries/lists.sql b/queries/lists.sqlindex b0c4a910..1b7712cc 100644--- a/queries/lists.sql+++ b/queries/lists.sql@@ -1,11 +1,12 @@-- lists-- name: get-listsSELECT * FROM lists WHERE (CASE WHEN $1 = '' THEN 1=1 ELSE type=$1::list_type END)+ AND (CASE WHEN $2 = '' THEN 1=1 ELSE status=$2::list_status END)AND CASE-- Optional list IDs based on user permission.- WHEN $3 = TRUE THEN TRUE ELSE id = ANY($4::INT[])+ WHEN $4 = TRUE THEN TRUE ELSE id = ANY($5::INT[])END- ORDER BY CASE WHEN $2 = 'id' THEN id END, CASE WHEN $2 = 'name' THEN name END;+ ORDER BY CASE WHEN $3 = 'id' THEN id END, CASE WHEN $3 = 'name' THEN name END;-- name: query-listsWITH ls AS (@@ -18,12 +19,13 @@ WITH ls AS (ENDAND ($4 = '' OR type = $4::list_type)AND ($5 = '' OR optin = $5::list_optin)- AND (CARDINALITY($6::VARCHAR(100)[]) = 0 OR $6 <@ tags)+ AND ($6 = '' OR status = $6::list_status)+ AND (CARDINALITY($7::VARCHAR(100)[]) = 0 OR $7 <@ tags)AND CASE-- Optional list IDs based on user permission.- WHEN $7 = TRUE THEN TRUE ELSE id = ANY($8::INT[])+ WHEN $8 = TRUE THEN TRUE ELSE id = ANY($9::INT[])END- OFFSET $9 LIMIT (CASE WHEN $10 < 1 THEN NULL ELSE $10 END)+ OFFSET $10 LIMIT (CASE WHEN $11 < 1 THEN NULL ELSE $11 END)),statuses AS (SELECT@@ -51,15 +53,16 @@ SELECT id, uuid, type FROM lists WHEREEND);-- name: create-list-INSERT INTO lists (uuid, name, type, optin, tags, description) VALUES($1, $2, $3, $4, $5, $6) RETURNING id;+INSERT INTO lists (uuid, name, type, optin, status, tags, description) VALUES($1, $2, $3, $4, $5, $6, $7) RETURNING id;-- name: update-listUPDATE lists SETname=(CASE WHEN $2 != '' THEN $2 ELSE name END),type=(CASE WHEN $3 != '' THEN $3::list_type ELSE type END),optin=(CASE WHEN $4 != '' THEN $4::list_optin ELSE optin END),- tags=$5::VARCHAR(100)[],- description=(CASE WHEN $6 != '' THEN $6 ELSE description END),+ status=(CASE WHEN $5 != '' THEN $5::list_status ELSE status END),+ tags=$6::VARCHAR(100)[],+ description=(CASE WHEN $7 != '' THEN $7 ELSE description END),updated_at=NOW()WHERE id = $1;diff --git a/schema.sql b/schema.sqlindex 2e2f2405..09735051 100644--- a/schema.sql+++ b/schema.sql@@ -1,5 +1,6 @@DROP TYPE IF EXISTS list_type CASCADE; CREATE TYPE list_type AS ENUM ('public', 'private', 'temporary');DROP TYPE IF EXISTS list_optin CASCADE; CREATE TYPE list_optin AS ENUM ('single', 'double');+DROP TYPE IF EXISTS list_status CASCADE; CREATE TYPE list_status AS ENUM ('active', 'archived');DROP TYPE IF EXISTS subscriber_status CASCADE; CREATE TYPE subscriber_status AS ENUM ('enabled', 'disabled', 'blocklisted');DROP TYPE IF EXISTS subscription_status CASCADE; CREATE TYPE subscription_status AS ENUM ('unconfirmed', 'confirmed', 'unsubscribed');DROP TYPE IF EXISTS campaign_status CASCADE; CREATE TYPE campaign_status AS ENUM ('draft', 'running', 'scheduled', 'paused', 'cancelled', 'finished');@@ -41,6 +42,7 @@ CREATE TABLE lists (name TEXT NOT NULL,type list_type NOT NULL,optin list_optin NOT NULL DEFAULT 'single',+ status list_status NOT NULL DEFAULT 'active',tags VARCHAR(100)[],description TEXT NOT NULL DEFAULT '',@@ -49,6 +51,7 @@ CREATE TABLE lists ();DROP INDEX IF EXISTS idx_lists_type; CREATE INDEX idx_lists_type ON lists(type);DROP INDEX IF EXISTS idx_lists_optin; CREATE INDEX idx_lists_optin ON lists(optin);+DROP INDEX IF EXISTS idx_lists_status; CREATE INDEX idx_lists_status ON lists(status);DROP INDEX IF EXISTS idx_lists_name; CREATE INDEX idx_lists_name ON lists(name);DROP INDEX IF EXISTS idx_lists_created_at; CREATE INDEX idx_lists_created_at ON lists(created_at);DROP INDEX IF EXISTS idx_lists_updated_at; CREATE INDEX idx_lists_updated_at ON lists(updated_at);