Content
View differences
Updated by Ivana Šugić 3 days ago
###
Before filing a report
_Before you file a report, please ensure you are running the latest version of OpenProject and_
_have searched for similar bug reports._
### Steps to reproduce
_Please write down the steps to reproduce. Try to write down all necessary preconditions (what permissions do you have, are other users involved?). Example:_
1. 1\. On a fresh instance (outgoing email not yet configured), go to
2. Administration Administration > Emails and notifications > Email notifications
3. ( ( /admin/settings/mail\_notifications ).
4. 2\. Observe the "Email delivery method" dropdown. It displays "smtp".
5. 3\. Try to enter your SMTP server / port / username / password.
### What is the buggy behavior?
There are no SMTP fields on screen. The "Email delivery method" dropdown already shows
"smtp", but the SMTP server / port / authentication / username / password inputs are not
displayed, so there is nowhere to type the settings.
Clicking the dropdown and selecting "smtp" (the value already shown) does nothing,
because selecting the already-selected value does not emit a `change` event. The only
way to make the fields appear is the non-obvious workaround of selecting "sendmail"
first and then switching back to "smtp", which finally fires a `change` event and
reveals the fields. The fields are hidden again on every subsequent page load.
### What is the expected behavior?
<br>
On page load, the SMTP field group should be shown whenever the "Email delivery method"
dropdown's current value is "smtp" (and the sendmail field group when it is "sendmail"),
without requiring the user to toggle the dropdown. The visible state of the conditional
fields should always match the currently selected delivery method, including on initial
render.
###
Important note
_Please note that unless you are a contributor to OpenProject, you can no longer edit this bug report after saving. You can still add new comments, new images and upload attachments though, but updating description or modifying fields will not be possible after saving. Please make sure that all necessary information and attachments are added, and the following attributes are set:_
### **Logs**
_Are there errors in the browser console? (_[_Click here for information on how to open your browser's console_](https://webmasters.stackexchange.com/a/77337)_) For a local installation: Are there relevant logs output by_ `_openproject logs_` _(packaged installation) (_[_click here for details_](https://docs.openproject.org/installation-and-operations/operation/monitoring/#show-logs)_) or in a log/production.log or /var/log/openproject/ ? Please attach error output in these log files if applicable_
### Screenshots and other files
_If you have screenshots of the application's bug behavior or other relevant files, please drag them into this place or attach them using the "Files" section._
### Environment information
_Please check and fill out the following details to help us identify in what versions and distributions of OpenProject the error occurs_
**OpenProject installation type**
* Hosted cloud edition
* Packaged installation
* What distribution?
* Docker All-in-one container
* Docker-compose installation
* Other (please specify)
**OpenProject version**
_If you're not running on the cloud edition, please specify the version of OpenProject you're running. Example: v12.1.5_
**Browser**
* [x] Chrome
* [ ] Firefox
* [ ] Safari
* [ ] Mobile Safari
* [ ] Other (please specify)
**Operating System**
* [ ] Windows
* [ ] Mac OS X
* [ ] Mobile iOS
* [ ] Mobile Android
* [x] Linux (please specify distro) (see below)
* [ ] Chrome OS
* [ ] Other (please specify)
**Language**
_Please specify the browser language and the language of the OpenProject user for which the bug occurred._
**\===========================================================================================**
SUGGESTED CODE FIX
**\===========================================================================================**
Evaluate the current state once when the cause element connects, so the conditional
fields render correctly on load. Factor the existing body out of `toggleDisabled` into a
shared method and call it from both `causeTargetConnected` and the change handler.
`frontend/src/stimulus/controllers/show-when-value-selected.controller.ts`:
causeTargetConnected(target: HTMLInputElement | HTMLSelectElement) {
target.addEventListener('change', this.boundListener);
this.applyFor(target); // <-- NEW: evaluate initial state on load
}
causeTargetDisconnected(target: HTMLInputElement | HTMLSelectElement) {
target.removeEventListener('change', this.boundListener);
}
toggleDisabled(evt: Event) {
this.applyFor(evt.target as HTMLInputElement | HTMLSelectElement); // unchanged behaviour
}
private applyFor(input: HTMLInputElement | HTMLSelectElement) {
const targetName = input.dataset.targetName;
this.effectTargets
.filter((el) => targetName === el.dataset.targetName)
.forEach((el) => {
const disabled = this.willDisable(el, input.value);
(el as HTMLInputElement).disabled = disabled;
if (el.dataset.setVisibility === 'true') {
toggleElementByVisibility(el, !disabled);
} else {
toggleElement(el, !disabled);
}
});
}
This preserves the existing change-driven behaviour exactly (it just calls the same logic
from `applyFor`) and additionally reconciles visibility on connect, so the SMTP/sendmail
groups always match the selected delivery method on first render.
**\===========================================================================================**
ENVIRONMENT SUMMARY
**\===========================================================================================**
Product / version : OpenProject 17.5.1, Community edition
Installation : Packaged (DEB) install
OS : Debian 12
Web server : Apache/2.4.67 (Debian), HTTP (no TLS)
Affected file : frontend/src/stimulus/controllers/show-when-value-selected.controller.ts
Affected page : /admin/settings/mail\_notifications
Severity : Medium — blocks configuring outgoing email through the web UI on a
fresh install; not a crash and has a non-obvious workaround.
_Before you file a report, please ensure you are running the latest version of OpenProject and_
_have searched for similar bug reports._
2. Administration
3. (
4. 2\. Observe the "Email delivery method" dropdown. It displays "smtp".
5. 3\. Try to enter your SMTP server / port / username / password.
### What is the buggy behavior?
There are no SMTP fields on screen. The "Email delivery method" dropdown already shows
"smtp", but the SMTP server / port / authentication / username / password inputs are not
displayed, so there is nowhere to type the settings.
Clicking the dropdown and selecting "smtp" (the value already shown) does nothing,
because selecting the already-selected value does not emit a `change` event. The only
way to make the fields appear is the non-obvious workaround of selecting "sendmail"
first and then switching back to "smtp", which finally fires a `change` event and
reveals the fields. The fields are hidden again on every subsequent page load.
### What is the expected behavior?
<br>
On page load, the SMTP field group should be shown whenever the "Email delivery method"
dropdown's current value is "smtp" (and the sendmail field group when it is "sendmail"),
without requiring the user to toggle the dropdown. The visible state of the conditional
fields should always match the currently selected delivery method, including on initial
render.
###
_Please note that unless you are a contributor to OpenProject, you can no longer edit this bug report after saving. You can still add new comments, new images and upload attachments though, but updating description or modifying fields will not be possible after saving. Please make sure that all necessary information and attachments are added, and the following attributes are set:_
_Are there errors in the browser console? (_[_Click here for information on how to open your browser's console_](https://webmasters.stackexchange.com/a/77337)_) For a local installation: Are there relevant logs output by_ `_openproject logs_` _(packaged installation) (_[_click here for details_](https://docs.openproject.org/installation-and-operations/operation/monitoring/#show-logs)_) or in a log/production.log or /var/log/openproject/ ? Please attach error output in these log files if applicable_
### Screenshots and other files
_If you have screenshots of the application's bug behavior or other relevant files, please drag them into this place or attach them using the "Files" section._
###
**OpenProject installation type**
* Hosted cloud edition
* Packaged installation
* What distribution?
* Docker All-in-one container
* Docker-compose installation
* Other (please specify)
**OpenProject version**
_If you're not running on the cloud edition, please specify the version of OpenProject you're running. Example: v12.1.5_
* [x] Chrome
* [ ] Firefox
* [ ] Safari
* [ ] Mobile Safari
* [ ] Other (please specify)
**Operating System**
* [ ] Windows
* [ ] Mac OS X
* [ ] Mobile iOS
* [ ] Mobile Android
* [x] Linux (please specify distro) (see below)
* [ ] Chrome OS
* [ ] Other (please specify)
**Language**
_Please specify the browser language and the language of the OpenProject user for which the bug occurred._
**\===========================================================================================**
SUGGESTED CODE FIX
**\===========================================================================================**
fields render correctly on load. Factor the existing body out of `toggleDisabled` into a
shared method and call it from both `causeTargetConnected` and the change handler.
from `applyFor`) and additionally reconciles visibility on connect, so the SMTP/sendmail
groups always match the selected delivery method on first render.
**\===========================================================================================**
ENVIRONMENT SUMMARY
**\===========================================================================================**
Product / version : OpenProject 17.5.1, Community edition
Installation : Packaged (DEB) install
OS : Debian 12
Web server : Apache/2.4.67 (Debian), HTTP (no TLS)
Affected file : frontend/src/stimulus/controllers/show-when-value-selected.controller.ts
Affected page : /admin/settings/mail\_notifications
Severity : Medium — blocks configuring outgoing email through the web UI on a