Files
listmonk/models/lists.go
Kailash Nadh 2074604512 Add archival support to lists.
This patch adds a new `status` field (active, archived) to the lists table and
an 'Archived?' toggle on the UI that allows a list to be marked as archived.
This hides the lists from the lists page, campaigns list selection, list roles,
and public forms. A new "View archived lists" link on the lists UI allows
viewing the list of archived lists.

This is useful to hide/declutter lists by archiving historical, temporary lists
etc. This is largely a UX value addition.

Closes #2613.
2025-11-23 15:39:17 +05:30

41 lines
1.5 KiB
Go

package models
import (
"github.com/lib/pq"
null "gopkg.in/volatiletech/null.v6"
)
const (
ListTypePrivate = "private"
ListTypePublic = "public"
ListOptinSingle = "single"
ListOptinDouble = "double"
ListStatusActive = "active"
ListStatusArchived = "archived"
)
// List represents a mailing list.
type List struct {
Base
UUID string `db:"uuid" json:"uuid"`
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"`
SubscriberCounts StringIntMap `db:"subscriber_statuses" json:"subscriber_statuses"`
SubscriberID int `db:"subscriber_id" json:"-"`
// This is only relevant when querying the lists of a subscriber.
SubscriptionStatus string `db:"subscription_status" json:"subscription_status,omitempty"`
SubscriptionCreatedAt null.Time `db:"subscription_created_at" json:"subscription_created_at,omitempty"`
SubscriptionUpdatedAt null.Time `db:"subscription_updated_at" json:"subscription_updated_at,omitempty"`
// Pseudofield for getting the total number of subscribers
// in searches and queries.
Total int `db:"total" json:"-"`
}