Skip to content

Commit 2e1f799

Browse files
committed
Fix TypeError when logging out
1 parent d647c57 commit 2e1f799

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Remove modal from the DOM when it's closed
77
- Fix login form style for `classic` theme
88
- Properly handle OGP metadata that doesn't have an image
9+
- Fix TypeError which prevents logging out
910

1011
## 11.0.0 (2025-05-21)
1112

src/shared/chat/baseview.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,25 @@ import { onScrolledDown } from './utils.js';
77

88
const { CHATROOMS_TYPE, INACTIVE } = constants;
99

10-
1110
export default class BaseChatView extends CustomElement {
12-
13-
static get properties () {
11+
static get properties() {
1412
return {
15-
jid: { type: String }
16-
}
13+
jid: { type: String },
14+
};
1715
}
1816

19-
constructor () {
17+
constructor() {
2018
super();
2119
this.jid = /** @type {string} */ null;
2220
this.model = /** @type {Model} */ null;
2321
}
2422

25-
disconnectedCallback () {
23+
disconnectedCallback() {
2624
super.disconnectedCallback();
2725
_converse.state.chatboxviews.remove(this.jid, this);
2826
}
2927

30-
updated () {
28+
updated() {
3129
if (this.model && this.jid !== this.model.get('jid')) {
3230
this.stopListening();
3331
_converse.state.chatboxviews.remove(this.model.get('jid'), this);
@@ -37,32 +35,35 @@ export default class BaseChatView extends CustomElement {
3735
}
3836
}
3937

40-
close (ev) {
38+
/**
39+
* @param {MouseEvent} ev
40+
*/
41+
close(ev) {
4142
ev?.preventDefault?.();
42-
return this.model.close(ev);
43+
return this.model?.close(ev);
4344
}
4445

45-
maybeFocus () {
46+
maybeFocus() {
4647
api.settings.get('auto_focus') && this.focus();
4748
}
4849

49-
focus () {
50+
focus() {
5051
const textarea_el = this.getElementsByClassName('chat-textarea')[0];
5152
if (textarea_el && document.activeElement !== textarea_el) {
52-
/** @type {HTMLTextAreaElement} */(textarea_el).focus();
53+
/** @type {HTMLTextAreaElement} */ (textarea_el).focus();
5354
}
5455
return this;
5556
}
5657

57-
getBottomPanel () {
58+
getBottomPanel() {
5859
if (this.model.get('type') === CHATROOMS_TYPE) {
5960
return this.querySelector('converse-muc-bottom-panel');
6061
} else {
6162
return this.querySelector('converse-chat-bottom-panel');
6263
}
6364
}
6465

65-
getMessageForm () {
66+
getMessageForm() {
6667
if (this.model.get('type') === CHATROOMS_TYPE) {
6768
return this.querySelector('converse-muc-message-form');
6869
} else {
@@ -77,7 +78,7 @@ export default class BaseChatView extends CustomElement {
7778
* whether the user scrolled up manually or not.
7879
* @param { Event } [ev] - An optional event that is the cause for needing to scroll down.
7980
*/
80-
scrollDown (ev) {
81+
scrollDown(ev) {
8182
ev?.preventDefault?.();
8283
ev?.stopPropagation?.();
8384
if (this.model.ui.get('scrolled')) {
@@ -86,7 +87,7 @@ export default class BaseChatView extends CustomElement {
8687
onScrolledDown(this.model);
8788
}
8889

89-
onWindowStateChanged () {
90+
onWindowStateChanged() {
9091
if (document.hidden) {
9192
this.model.setChatState(INACTIVE, { 'silent': true });
9293
} else {

src/types/shared/chat/baseview.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ export default class BaseChatView extends CustomElement {
77
jid: any;
88
model: any;
99
updated(): void;
10-
close(ev: any): any;
10+
/**
11+
* @param {MouseEvent} ev
12+
*/
13+
close(ev: MouseEvent): any;
1114
maybeFocus(): void;
1215
focus(): this;
1316
getBottomPanel(): Element;

0 commit comments

Comments
 (0)