Commit graph

139 commits

Author SHA1 Message Date
Bowrna 16f4dfd3e9
Fix incorrect bulk blocklisting behaviour (#2041). Fixes #1841 2024-09-19 10:56:56 +05:30
Kailash Nadh 51e3f1789b Fix pre-confirm status not working on subscriber update. Closes #1927. 2024-09-03 23:39:02 +05:30
Bowrna ebac8b3b4c
Fix broken campaign clone with deleted lists (#1966)
Co-authored-by: Kailash Nadh <kailash@nadh.in>
2024-08-02 21:33:43 +05:30
Keshav Gupta c334d2e6e1
fix #1950:Export of unsubscribed users exports all users (#1965)
Co-authored-by: keshav <keshav.gupta@jarvis.consulting>
2024-08-02 00:05:33 +05:30
Kailash Nadh fedc51514d Fix incorrect count in subscriber query when there are no results. 2024-08-02 00:03:22 +05:30
zevszym b38f1562ee
fix vanishing attachments in campaign in more the one campaigns setup (#1936) 2024-07-17 10:42:51 +05:30
Shivam Mishra ec50bef292
fix: query campaign does not search numbers (#1758) 2024-03-08 09:48:34 +05:30
Kailash Nadh 284158666b Fix sorting in camapaign analytics view counts. 2024-01-28 10:59:51 +05:30
Kailash Nadh 5a3664aee2 Add support for caching slow queries on large databases.
- Add materialized views for list -> subscriber counts, dashboard chart,
  and dashboard aggregate stats that slow down significantly on large
  databases (with millions or tens of millions of subscribers). These
  slow queries involve full table scan COUNTS().

- Add a toggle to enable caching slow results in Settings -> Performance.

- Add support for setting a cron string that crons and periodically
  refreshes aggregated stats in materialized views.

Closes #1019.
2024-01-27 15:51:12 +05:30
Kailash Nadh 0d319ad9fd Add 'slug' (permalink) support for campaign archives. Closes #1394. 2024-01-09 23:34:08 +05:30
Kailash Nadh 772476c0df Add accurate sent count, last sent subscriber tracking on campaigns.
- Sent count is no longer the batch size fetched from the DB but is
  the actual count of messages sent.
- Pausing and resuming now accurately tracks the last subscriber that
  was processed and resumes from there.
- Fix multiple concurrent campaigns blocking.

Closes #1616. Closes #905. Closes #1496. Closes #1250. Closes #1010.
2024-01-02 14:57:04 +05:30
Kailash Nadh bce675870c Fix preconfirm option not working on bulk 'select all' subscriber list management. Closes #1646. 2023-12-30 20:52:14 +05:30
Kailash Nadh 51af75cfef Add subscription status filter to subscriber list query and admin UI. 2023-12-23 16:43:28 +05:30
Kailash Nadh 01acd386f6 Add tag/type/optin filter options to lists and campaigns APIs. Closes #1631. 2023-12-23 14:45:55 +05:30
Kailash Nadh c59825f3a5 Fix broken sorting (lists -> subcount, subscribers -> status) in queries. Closes #1076. 2023-11-12 10:29:32 +05:30
Kailash Nadh 44d3462559 Fix 'confirmed' subscriptions becoming 'unconfirmed' on public form re-signup. Closes #1441. 2023-11-11 18:46:38 +05:30
Kailash Nadh eefcbc30a3 Fix hardcoded DB name in 'about' SQL query. Closes #1477. 2023-08-27 13:20:41 +05:30
Ikko Eltociear Ashimine a1c507b477
Fix typo in queries.sql (#1432)
defualt -> default
2023-08-06 10:06:44 +05:30
Kailash Nadh ad80c716f9 Add new privacy option 'Record opt-in IP' to record IP address of optin confirmation.
- Add new 'Subscriptions' table on the subscriber list form that shows subs,
  IP, and other data.
- Add new `meta` JSONB field to `subscriber_lsts` table.

Closes #1329.
2023-07-26 23:00:32 +05:30
Kailash Nadh e1c0bf5030 Fix unsubbed subscribers not getting re-sub optin confirmation. Closes #1315. 2023-07-12 23:09:44 +05:30
Kailash Nadh c581fe2f3a Add GET /api/about that returns useful system info. Closes #1354. 2023-06-24 13:07:13 +05:30
Kailash Nadh d359ad27aa Refactor media management.
- Change tiled UI to table UI.
- Add support for search and pagination.
- Important: This breaks the `GET /api/media` API to introduce pagination
  fields. Media items are now moved into `{ data: results[] }`.
2023-05-21 15:19:12 +05:30
Kailash Nadh 3b9a0f782e
Add support for file attachments on campaigns (#1341)
- Adds support for arbitrary file uploads with an admin setting to select allowed file extensions.
- Adds support for attaching media (files) to campaigns.
2023-05-18 16:55:59 +05:30
Kailash Nadh 5fc28a733c Add support for variable bounce processing actions.
- Add support for `complaint` to the SES bounce processor.
- Add support for `hard/soft` to Sendgrid bounce processor.
- Add new bounce actions `None` and `Unsubscribe`.
- Add per type (`soft/hard/complaint`) bounce rule configuration to
  admin settings UI.
- Refactor Cypress bounce tests.
2023-04-11 11:33:40 +05:30
Justin Beaty 476d5bebf2
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>
2023-04-08 09:39:10 +05:30
Kailash Nadh aaf5080a27 Fix discrepency in SQL query/export queries. Closes #1241. 2023-03-19 12:53:05 +05:30
Kailash Nadh 49f20f33db Fix broken sorting in list query. Closes #1076.
- Replace "%s %s" sprintf substitution in some raw SQL queries with named
  string replace params. Eg: `%order%`.
2022-12-25 14:04:43 +05:30
Kailash Nadh 4dee2e9a1b Fix per_page=all in API calls in the paginator lib.
Closes #1098.
2022-12-25 00:43:58 +05:30
Kailash Nadh 8e3e1b9af8 Change naive ILIKE search to full text (unindexed) on lists and campaigns. Closes #1058. 2022-11-27 23:01:15 +05:30
Kailash Nadh 1e90feecaf Show send_at on archive page for scheduled campaigns. Closes #1036. 2022-11-18 23:12:53 +05:30
Kailash Nadh eaaca05f36 Fix archive template selection in campaign creation query. 2022-11-10 23:30:53 +05:30
Kailash Nadh 9add728b08 WIP: Add support for publishing campaigns to publish archives. 2022-11-10 23:30:11 +05:30
Romain 6d3ae4cc73
Add subscription created_at, updated_at when listing subscribers list (#1018) 2022-11-09 21:40:11 +05:30
Kailash Nadh 879bff854e Update subscription date on public unsubscribe. Closes #915. 2022-11-01 21:46:07 +05:30
Kailash Nadh ef1f84ee7c Add new description field to lists. Closes #925. 2022-11-01 21:04:35 +05:30
Kailash Nadh 3b0083190e Add ability for subscribers to manage preferences on the unsub form.
- Ability to change name.
- Ability to unsubscribe from individual lists.
- Toggle option to enable this in Admin Settings -> Privacy.

Closes #455.
2022-10-29 15:23:28 +05:30
Kailash Nadh c38100427d Add arbitrary meta field to media. Closes #938.
- Add new `meta` JSONB field to `media` table.
- Start storing image width and height as meta with media uploads.
2022-10-02 23:04:51 +05:30
Kailash Nadh 6d820f4f6e Add maintenance options.
- Add new maintenance UI with options to garbage collect (delete)
  orphan subscriber and analytics records.
2022-09-03 14:58:25 +05:30
Kailash Nadh b497f52ae7 Merge branch 'fix-analytics' 2022-07-30 20:12:11 +05:30
Kailash Nadh bfc27def57 Fix regression of public subscriber page behaviour. 2022-07-30 20:11:59 +05:30
Kailash Nadh 3550d5453d Fix incorrect analytics count. Closes #712. 2022-07-30 19:01:20 +05:30
Kailash Nadh e99c8ed86b Disable template type updation after creation to prevent breaking of campaign relations. 2022-07-09 10:36:12 +05:30
Kailash Nadh 2dcac57cba Fix tx template delete query. 2022-07-09 10:36:12 +05:30
Kailash Nadh 463e92d1e1 Add transactional (tx) messaging capability.
This commit adds a new API `POST /api/tx` that sends an ad-hoc message
to a subscriber based on a pre-defined transactional template. This is
a large commit that adds the following:

- New campaign / tx template types on the UI. tx templates have an
  additional subject field.
- New fields `type` and `subject` to the templates table.
- Refactor template CRUD operations and models.
- Refactor template func assignment in manager.
- Add pre-compiled template caching to manager runtime.
- Pre-compile all tx templates into memory on program boot to avoid
  expensive template compilation on ad-hoc tx messages.
2022-07-09 10:36:12 +05:30
Kailash Nadh 59c9441b3b Fix subscriber create query to not ignore duplicate e-mail error.
Trying to insert a pre-existing e-mail on POST /api/subscribers
now return a 409 Conflict error.

Closes #718
2022-05-11 21:40:31 +05:30
Kailash Nadh 959541f8ee Rename unsub query to match the core method name. 2022-05-08 14:45:45 +05:30
Kailash Nadh b5cd9498b1 Refactore all CRUD functions to a new core package.
This is a long pending refactor. All the DB, query, CRUD, and related
logic scattered across HTTP handlers are now moved into a central
`core` package with clean, abstracted methods, decoupling HTTP
handlers from executing direct DB queries and other business logic.

eg: `core.CreateList()`, `core.GetLists()` etc.

- Remove obsolete subscriber methods.
- Move optin hook queries to core.
- Move campaign methods to `core`.
- Move all campaign methods to `core`.
- Move public page functions to `core`.
- Move all template functions to `core`.
- Move media and settings function to `core`.
- Move handler middleware functions to `core`.
- Move all bounce functions to `core`.
- Move all dashboard functions to `core`.
- Fix GetLists() not honouring type
- Fix unwrapped JSON responses.
- Clean up obsolete pre-core util function.
- Replace SQL array null check with cardinality check.
- Fix missing validations in `core` queries.
- Remove superfluous deps on internal `subimporter`.
- Add dashboard functions to `core`.
- Fix broken domain ban check.
- Fix broken subscriber check middleware.
- Remove redundant error handling.
- Remove obsolete functions.
- Remove obsolete structs.
- Remove obsolete queries and DB functions.
- Document the `core` package.
2022-05-03 10:50:29 +05:30
Kailash Nadh ef643a14a3 Add ability to export select subscriber ids.
- Add `id=[]` query param to `/api/subscribers/export` API.
- Add UI export prompt.
- Add Cypress tests.

Closes #739
2022-03-19 13:44:23 +05:30
Kailash Nadh 1b163d1895 Fix next-subscribers batch query for a ~210x speedup.
It was observed that the next-campaign-subscribers query on an instance
with ~9 million subscribers had slowed down significantly. Fetching
a batch of 5k subscribers was taking around ~25 seconds.

After multiple hours of debugging and trial and errors, it turned out
that Postgres was doing very poor query planning on JOINs with CTEs
because of the dynamic cardinality of some CTEs (even with just 1 row).
Afer rewriting the query and adding a hack to overcome the CTE
cardinality issue, the same query now takes a few milliseconds,
a speed up of several orders of magnitude.
2022-02-05 22:41:43 +05:30
Kailash Nadh 48ef3dcb14 Support status in bulk subscriber list update API. Closes #604. 2022-02-05 00:03:28 +05:30