From af15bf13503a619f66f8187901c75240bb909617 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Tue, 15 Jun 2021 10:09:25 +1000 Subject: [PATCH] FIX: Show group Email settings if just SMTP enabled (#13362) We previously only showed the link to the Email section of group settings if both SMTP and IMAP were enabled for a site, but this is not necessary now, only SMTP can be enabled by itself so we should show the section if SMTP is enabled. --- .../discourse/app/controllers/group-manage.js | 2 +- .../acceptance/group-manage-email-settings-test.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/controllers/group-manage.js b/app/assets/javascripts/discourse/app/controllers/group-manage.js index de7cea15125..3d4e6847852 100644 --- a/app/assets/javascripts/discourse/app/controllers/group-manage.js +++ b/app/assets/javascripts/discourse/app/controllers/group-manage.js @@ -29,7 +29,7 @@ export default Controller.extend({ }); if (!automatic) { - if (this.siteSettings.enable_imap && this.siteSettings.enable_smtp) { + if (this.siteSettings.enable_smtp) { defaultTabs.splice(2, 0, { route: "group.manage.email", title: "groups.manage.email.title", diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js index cbfbe082e7b..409393c0730 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js @@ -9,6 +9,10 @@ acceptance("Managing Group Email Settings - SMTP Disabled", function (needs) { test("When SiteSetting.enable_smtp is false", async function (assert) { await visit("/g/discourse/manage/email"); + assert.notOk( + queryAll(".user-secondary-navigation").text().includes("Email"), + "email link is not shown in the sidebar" + ); assert.equal( currentRouteName(), "group.manage.profile", @@ -25,6 +29,10 @@ acceptance( test("When SiteSetting.enable_smtp is true but SiteSetting.enable_imap is false", async function (assert) { await visit("/g/discourse/manage/email"); + assert.ok( + queryAll(".user-secondary-navigation").text().includes("Email"), + "email link is shown in the sidebar" + ); assert.equal( currentRouteName(), "group.manage.email", @@ -59,6 +67,10 @@ acceptance( test("enabling SMTP, testing, and saving", async function (assert) { await visit("/g/discourse/manage/email"); + assert.ok( + queryAll(".user-secondary-navigation").text().includes("Email"), + "email link is shown in the sidebar" + ); assert.ok( exists("#enable_imap:disabled"), "IMAP is disabled until SMTP settings are valid"