Properly set checkbox state in bookmark form

This commit is contained in:
JC Brand 2023-02-22 10:19:47 +01:00
parent 16b442ac19
commit e1e93c2ec9
3 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@
- Add the ability to set roles and affiliations via the MUC occupant modal - Add the ability to set roles and affiliations via the MUC occupant modal
- Fix `isOnlyEmojis is not a function` when using only `@converse/headless` - Fix `isOnlyEmojis is not a function` when using only `@converse/headless`
- Fix `autojoin` checkbox state in MUC bookmark form
## 10.1.2 (2023-02-17) ## 10.1.2 (2023-02-17)

View File

@ -25,7 +25,7 @@ class MUCBookmarkForm extends CustomElement {
onBookmarkFormSubmitted (ev) { onBookmarkFormSubmitted (ev) {
ev.preventDefault(); ev.preventDefault();
_converse.bookmarks.createBookmark({ _converse.bookmarks.createBookmark({
'jid': this.model.get('jid'), 'jid': this.jid,
'autojoin': ev.target.querySelector('input[name="autojoin"]')?.checked || false, 'autojoin': ev.target.querySelector('input[name="autojoin"]')?.checked || false,
'name': ev.target.querySelector('input[name=name]')?.value, 'name': ev.target.querySelector('input[name=name]')?.value,
'nick': ev.target.querySelector('input[name=nick]')?.value 'nick': ev.target.querySelector('input[name=nick]')?.value

View File

@ -25,7 +25,7 @@ export default (el) => {
<input class="form-control" type="text" name="nick" value="${nick || ''}" id="converse_muc_bookmark_nick"/> <input class="form-control" type="text" name="nick" value="${nick || ''}" id="converse_muc_bookmark_nick"/>
</fieldset> </fieldset>
<fieldset class="form-group form-check"> <fieldset class="form-group form-check">
<input class="form-check-input" id="converse_muc_bookmark_autojoin" type="checkbox" name="autojoin"/> <input class="form-check-input" id="converse_muc_bookmark_autojoin" type="checkbox" ?checked=${el.bookmark?.get('autojoin')} name="autojoin"/>
<label class="form-check-label" for="converse_muc_bookmark_autojoin">${i18n_autojoin}</label> <label class="form-check-label" for="converse_muc_bookmark_autojoin">${i18n_autojoin}</label>
</fieldset> </fieldset>
<fieldset class="form-group"> <fieldset class="form-group">