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
Fix incorre check on template deletion.
Kailash Nadhaa5eff915d0e
diff --git a/cmd/templates.go b/cmd/templates.goindex 637989f3..fb62520a 100644--- a/cmd/templates.go+++ b/cmd/templates.go@@ -1,7 +1,6 @@package mainimport (- "database/sql""errors""fmt""net/http"@@ -222,23 +221,15 @@ func handleDeleteTemplate(c echo.Context) error {if id < 1 {return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("globals.messages.invalidID"))- } else if id == 1 {- return echo.NewHTTPError(http.StatusBadRequest,- app.i18n.T("templates.cantDeleteDefault"))}var delID interr := app.queries.DeleteTemplate.Get(&delID, id)if err != nil {- if err == sql.ErrNoRows {- return c.JSON(http.StatusOK, okResp{true})- }-return echo.NewHTTPError(http.StatusInternalServerError,- app.i18n.Ts("globals.messages.errorCreating",+ app.i18n.Ts("globals.messages.errorDeleting","name", "{globals.terms.template}", "error", pqErrMsg(err)))}-if delID == 0 {return echo.NewHTTPError(http.StatusBadRequest,app.i18n.T("templates.cantDeleteDefault"))diff --git a/frontend/cypress.json b/frontend/cypress.jsonindex f8db83a8..ec9d4bce 100644--- a/frontend/cypress.json+++ b/frontend/cypress.json@@ -1,5 +1,5 @@{- "baseUrl": "http://localhost:9000",+ "baseUrl": "http://localhost:8080","env": {"server_init_command": "pkill -9 listmonk | cd ../ && ./listmonk --install --yes && ./listmonk > /dev/null 2>/dev/null &","username": "listmonk",diff --git a/frontend/cypress/integration/templates.js b/frontend/cypress/integration/templates.jsindex 48cc5af2..7e64e020 100644--- a/frontend/cypress/integration/templates.js+++ b/frontend/cypress/integration/templates.js@@ -26,7 +26,7 @@ describe('Templates', () => {cy.get('input[name=name]').clear().type('edited');cy.get('textarea[name=body]').clear().type('<span>test</span> {{ template "content" . }}',{ parseSpecialCharSequences: false, delay: 0 });- cy.get('footer.modal-card-foot button.is-primary').click();+ cy.get('.modal-card-foot button.is-primary').click();cy.wait(250);cy.get('tbody td[data-label="Name"] a').contains('edited');});@@ -40,7 +40,7 @@ describe('Templates', () => {cy.get('span').first().contains('test');cy.get('p').first().contains('Hi there');});- cy.get('footer.modal-card-foot button').click();+ cy.get('.modal-card-foot button').click();// Cloned one should have the full template.cy.get('tbody [data-cy=btn-preview').eq(1).click();@@ -49,7 +49,7 @@ describe('Templates', () => {cy.get('.wrap p').first().contains('Hi there');cy.get('.footer a').first().contains('Unsubscribe');});- cy.get('footer.modal-card-foot button').click();+ cy.get('.modal-card-foot button').click();});it('Sets default', () => {@@ -69,6 +69,7 @@ describe('Templates', () => {it('Deletes template', () => {+ cy.wait(250);cy.get('tbody td.actions [data-cy=btn-delete]').first().click();cy.get('.modal button.is-primary').click();cy.wait(250);diff --git a/frontend/src/assets/style.scss b/frontend/src/assets/style.scssindex 25ed8fb0..64c3537d 100644--- a/frontend/src/assets/style.scss+++ b/frontend/src/assets/style.scss@@ -244,7 +244,7 @@ section {padding: 15px 10px;border-color: $grey-lightest;}- .actions a {+ .actions a, .actions .a {margin: 0 10px;display: inline-block;}diff --git a/frontend/src/views/TemplateForm.vue b/frontend/src/views/TemplateForm.vueindex 745098c4..944be762 100644--- a/frontend/src/views/TemplateForm.vue+++ b/frontend/src/views/TemplateForm.vue@@ -17,7 +17,7 @@</b-field><b-field :label="$t('templates.rawHTML')" label-position="on-border">- <b-input v-model="form.body" type="textarea" required />+ <b-input v-model="form.body" type="textarea" name="body" required /></b-field><p class="is-size-7">