Fixed - [install] [app-ini-import] [mailer] Corrected installer app.ini import so imported mailer sender details and Site Title branding fully replace the current form state.
- 1 - I updated `routers/install/install.go`, `routers/install/routes_test.go`, and `templates/install.tmpl` so importing `app.ini` now replaces stale split mailer sender fields with the imported `FROM = site_name <email@example.com>` value and immediately refreshes the derived `Install %s` button label from the imported `APP_NAME`.
This commit is contained in:
@@ -854,3 +854,6 @@ History search guidance:
|
||||
174 - [2026-05-22 19:36:16] - v1.27.0-dev-185-ga36bddc1c2 - Type: Modified - [badge] [label] [repo] [repo-explore] [visibility-badge] [admin] Refined the repo visibility badges (`Public` / `Privat`) and the small `by ...` labels, and kept long admin badge slugs on a single line.
|
||||
- 1 - I updated `web_src/css/modules/label.css` so the repo visibility badges and the small attribution labels such as `by ...` now use a pill-style border radius with tighter horizontal padding, giving both label families a more compact visual treatment.
|
||||
- 2 - I updated `templates/admin/badge/list.tmpl` to keep badge slug cells on a single line with `tw-whitespace-nowrap`, preventing awkward wrapping in the admin badge list.
|
||||
|
||||
175 - [2026-05-22 20:53:37] - v1.27.0-dev-186-gc498ee9b9c - Type: Fixed - [install] [app-ini-import] [mailer] Corrected installer `app.ini` import so imported mailer sender details and `Site Title` branding fully replace the current form state.
|
||||
- 1 - I updated `routers/install/install.go`, `routers/install/routes_test.go`, and `templates/install.tmpl` so importing `app.ini` now replaces stale split mailer sender fields with the imported `FROM = site_name <email@example.com>` value and immediately refreshes the derived `Install %s` button label from the imported `APP_NAME`.
|
||||
|
||||
@@ -445,6 +445,14 @@ func populateInstallFormFromConfig(form *forms.InstallForm, cfg setting.ConfigPr
|
||||
form.AppURL = setting.ConfigSectionKeyString(serverSec, "ROOT_URL", form.AppURL)
|
||||
form.LogRootPath = setting.ConfigSectionKeyString(logSec, "ROOT_PATH", form.LogRootPath)
|
||||
|
||||
form.SMTPAddr = ""
|
||||
form.SMTPPort = ""
|
||||
form.SMTPFrom = ""
|
||||
form.SMTPFromName = ""
|
||||
form.SMTPFromAddress = ""
|
||||
form.SMTPUser = ""
|
||||
form.SMTPPasswd = ""
|
||||
|
||||
if setting.ConfigSectionKeyBool(mailerSec, "ENABLED") {
|
||||
form.SMTPAddr = setting.ConfigSectionKeyString(mailerSec, "SMTP_ADDR", form.SMTPAddr)
|
||||
form.SMTPPort = setting.ConfigSectionKeyString(mailerSec, "SMTP_PORT", form.SMTPPort)
|
||||
|
||||
@@ -185,6 +185,30 @@ LANGS = de-DE,en-US
|
||||
assert.Equal(t, "super_admin_only", form.AdminManagementPolicy)
|
||||
}
|
||||
|
||||
func TestPopulateInstallFormFromConfigReplacesSMTPFromSplitFields(t *testing.T) {
|
||||
cfg, err := setting.NewConfigProviderFromData(`
|
||||
APP_NAME = gitSafe: for your code
|
||||
|
||||
[mailer]
|
||||
ENABLED = true
|
||||
SMTP_ADDR = smtp.example.com
|
||||
SMTP_PORT = 587
|
||||
FROM = gitSafe <noreply@example.com>
|
||||
`)
|
||||
require.NoError(t, err)
|
||||
|
||||
form, curDBType := newInstallFormFromSettings()
|
||||
form.SMTPFrom = "Legacy <legacy@example.com>"
|
||||
form.SMTPFromName = "Legacy"
|
||||
form.SMTPFromAddress = "legacy@example.com"
|
||||
|
||||
populateInstallFormFromConfig(&form, cfg, curDBType)
|
||||
|
||||
assert.Equal(t, "gitSafe <noreply@example.com>", form.SMTPFrom)
|
||||
assert.Equal(t, "gitSafe", form.SMTPFromName)
|
||||
assert.Equal(t, "noreply@example.com", form.SMTPFromAddress)
|
||||
}
|
||||
|
||||
func TestPopulateInstallFormFromConfigWithSensitiveSecrets(t *testing.T) {
|
||||
cfg, err := setting.NewConfigProviderFromData(`
|
||||
[server]
|
||||
|
||||
+20
-16
@@ -639,25 +639,29 @@
|
||||
const installConfirmButton = installForm?.querySelector('.js-install-confirm-button');
|
||||
if (appNameInput instanceof HTMLInputElement && smtpFromNameInput instanceof HTMLInputElement) {
|
||||
let lastAutoMailerName = smtpFromNameInput.value.trim() || deriveInstallMailerName(appNameInput.value);
|
||||
if (!smtpFromNameInput.value.trim()) {
|
||||
smtpFromNameInput.value = lastAutoMailerName;
|
||||
}
|
||||
if (installConfirmButton instanceof HTMLButtonElement) {
|
||||
installConfirmButton.textContent = installConfirmButton.dataset.installLabelTemplate.replace('__SITE_NAME__', lastAutoMailerName);
|
||||
}
|
||||
|
||||
appNameInput.addEventListener('input', () => {
|
||||
const syncInstallBranding = () => {
|
||||
const siteName = deriveInstallMailerName(appNameInput.value);
|
||||
const currentValue = smtpFromNameInput.value.trim();
|
||||
if (currentValue && currentValue !== lastAutoMailerName) return;
|
||||
lastAutoMailerName = deriveInstallMailerName(appNameInput.value);
|
||||
smtpFromNameInput.value = lastAutoMailerName;
|
||||
if (installConfirmButton instanceof HTMLButtonElement) {
|
||||
installConfirmButton.textContent = installConfirmButton.dataset.installLabelTemplate.replace('__SITE_NAME__', lastAutoMailerName);
|
||||
if (!currentValue || currentValue === lastAutoMailerName) {
|
||||
smtpFromNameInput.value = siteName;
|
||||
}
|
||||
});
|
||||
lastAutoMailerName = siteName;
|
||||
if (installConfirmButton instanceof HTMLButtonElement) {
|
||||
installConfirmButton.textContent = installConfirmButton.dataset.installLabelTemplate.replace('__SITE_NAME__', siteName);
|
||||
}
|
||||
};
|
||||
|
||||
syncInstallBranding();
|
||||
appNameInput.addEventListener('input', syncInstallBranding);
|
||||
appNameInput.addEventListener('change', syncInstallBranding);
|
||||
} else if (appNameInput instanceof HTMLInputElement && installConfirmButton instanceof HTMLButtonElement) {
|
||||
const siteName = deriveInstallMailerName(appNameInput.value);
|
||||
installConfirmButton.textContent = installConfirmButton.dataset.installLabelTemplate.replace('__SITE_NAME__', siteName);
|
||||
const syncInstallButton = () => {
|
||||
const siteName = deriveInstallMailerName(appNameInput.value);
|
||||
installConfirmButton.textContent = installConfirmButton.dataset.installLabelTemplate.replace('__SITE_NAME__', siteName);
|
||||
};
|
||||
syncInstallButton();
|
||||
appNameInput.addEventListener('input', syncInstallButton);
|
||||
appNameInput.addEventListener('change', syncInstallButton);
|
||||
}
|
||||
|
||||
for (const button of document.querySelectorAll('.js-install-test-mail-button')) {
|
||||
|
||||
Reference in New Issue
Block a user