Fixes #2628: Open bookmarks toggle emits an error

This commit is contained in:
JC Brand 2021-09-06 21:09:22 +02:00
parent b75e67fafa
commit f04a376653
5 changed files with 31 additions and 28 deletions

View File

@ -2,6 +2,8 @@
## 8.0.1 (Unreleased)
- #2628: Open groupchats toggle emits an error
- #2629: OMEMO button tooltip is wrong in private chat
- #2634: Image previews not loading when not serving Converse locally
## 8.0.0 (2021-09-03)

1
package-lock.json generated
View File

@ -5,7 +5,6 @@
"requires": true,
"packages": {
"": {
"name": "converse.js",
"version": "8.0.0",
"license": "MPL-2.0",
"dependencies": {

View File

@ -39,9 +39,7 @@ export default class BookmarksView extends ElementView {
}
toggleBookmarksList (ev) {
if (ev && ev.preventDefault) {
ev.preventDefault();
}
ev?.preventDefault?.();
const icon_el = ev.target.matches('.fa') ? ev.target : ev.target.querySelector('.fa');
if (u.hasClass('fa-caret-down', icon_el)) {
u.slideIn(this.querySelector('.bookmarks'));

View File

@ -0,0 +1,23 @@
import { Model } from '@converse/skeletor/src/model.js';
import { _converse, api, converse } from "@converse/headless/core";
const { Strophe } = converse.env;
const RoomsListModel = Model.extend({
defaults: function () {
return {
'muc_domain': api.settings.get('muc_domain'),
'nick': _converse.getDefaultMUCNickname(),
'toggle-state': _converse.OPENED,
};
},
setDomain (jid) {
if (!api.settings.get('locked_muc_domain')) {
this.save('muc_domain', Strophe.getDomainFromJid(jid));
}
}
});
export default RoomsListModel;

View File

@ -1,32 +1,13 @@
import RoomDetailsModal from 'modals/muc-details.js';
import tpl_roomslist from "./templates/roomslist.js";
import { ElementView } from '@converse/skeletor/src/element.js';
import { Model } from '@converse/skeletor/src/model.js';
import RoomsListModel from './model.js';
import { __ } from 'i18n';
import { _converse, api, converse } from "@converse/headless/core";
import { initStorage } from '@converse/headless/utils/storage.js';
import { render } from 'lit';
const { Strophe } = converse.env;
const u = converse.env.utils;
const RoomsListModel = Model.extend({
defaults: function () {
return {
'muc_domain': api.settings.get('muc_domain'),
'nick': _converse.getDefaultMUCNickname(),
'toggle-state': _converse.OPENED,
};
},
setDomain (jid) {
if (!api.settings.get('locked_muc_domain')) {
this.save('muc_domain', Strophe.getDomainFromJid(jid));
}
}
});
const { Strophe, u } = converse.env;
export class RoomsList extends ElementView {
@ -109,16 +90,16 @@ export class RoomsList extends ElementView {
}
toggleRoomsList (ev) {
if (ev && ev.preventDefault) { ev.preventDefault(); }
ev?.preventDefault?.();
const icon_el = ev.target.matches('.fa') ? ev.target : ev.target.querySelector('.fa');
if (icon_el.classList.contains("fa-caret-down")) {
u.slideIn(this.el.querySelector('.open-rooms-list')).then(() => {
u.slideIn(this.querySelector('.open-rooms-list')).then(() => {
this.model.save({'toggle-state': _converse.CLOSED});
icon_el.classList.remove("fa-caret-down");
icon_el.classList.add("fa-caret-right");
});
} else {
u.slideOut(this.el.querySelector('.open-rooms-list')).then(() => {
u.slideOut(this.querySelector('.open-rooms-list')).then(() => {
this.model.save({'toggle-state': _converse.OPENED});
icon_el.classList.remove("fa-caret-right");
icon_el.classList.add("fa-caret-down");