Commit graph

16 commits

Author SHA1 Message Date
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
5a5caca256 Refactor campaign/template preview functions and component. 2022-07-09 10:36:12 +05:30
Kailash Nadh
0574a1b820 Fix template compilation check on CRUD. 2022-07-09 10:36:12 +05:30
Kailash Nadh
68da86aadc Fix redundant echo/http error wrapping. 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
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
e9709e54ee Upgrade labstack/echo webserver to major version v4.
- echo is now on v4 with major changes including a few breaking changes
- bind() behaviour is now strict. JSON / form etc. unmarshalling of
  request data need appropriate `json`, `form` tags. Missing tags for
  the public subscription page is added in this commit.
- This also closes #602.
2021-12-09 20:51:07 +05:30
Kailash Nadh
9d2bc9c41d Add HTML syntax highlighted editing to the template editor.
- Refactor codeflask HTML editor into a standalone html-editor
  component.
- Replace the plaintext box in the template editor with html-editor.
- Replace codeflask in the campaign editor with the new html-editor.
- Refactor templates Cypress tests to test the new editor.
- Refactor campaigns Cypress tests to test the new editor and also
  test switching between different editors and content formats.
2021-09-26 21:56:53 +05:30
Kailash Nadh
931e467b25 Fixes campaign test messages not including unsub headers.
Campaign messages are handled by `manager` whereas test messages
were being pushed directly into a messenger skipping some campaign
related routines such as the addition of list unsub headers.

This commit exposes a new function `manager.PushCampaignMessage()`
that accepts arbitrary campaign messages that then pass through
the standard campaign message workers, thus getting the missing unsub
headers. This closes #360.

In addition, this removes the superfluous `CampaignMessage.Render()`
function which had to be mandatorily called always and makes it
implicit in `manager.NewCampaignMessage()`.
2021-05-21 23:35:08 +05:30
Kailash Nadh
aa5eff915d Fix incorre check on template deletion. 2021-05-16 15:26:38 +05:30
Kailash Nadh
f8e555dac5 Fix incorrect ID handling in update handlers 2021-03-09 17:54:07 +05:30
Kailash Nadh
4cd5e6ebeb Refactor and remove placeholder i18n func 2021-01-23 18:54:33 +05:30
Kailash Nadh
810607e547 Fix incorrect i18n keys in message strings 2021-01-23 18:48:10 +05:30
Kailash Nadh
3498a727f5 WIP: Add i18n support 2021-01-17 20:59:01 +05:30
Kailash Nadh
1e8b533d45 Fix echo's URI routing race condition that caused random 404s. 2020-11-08 18:36:25 +05:30
Kailash Nadh
f3e80da339 Clean up root and move app to cmd directory 2020-08-08 13:54:25 +05:30
Renamed from templates.go (Browse further)