ssb: Add a button to close a private chat, removing it from the sidebar.
This commit is contained in:
@@ -433,6 +433,31 @@ class TfTabNewsFeedElement extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
close_private_chat() {
|
||||
this.mark_all_read();
|
||||
this.dispatchEvent(
|
||||
new CustomEvent('closeprivatechat', {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
detail: {
|
||||
key: JSON.stringify(this.hash.substring('#🔐'.length).split(',')),
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
render_close_chat_button() {
|
||||
if (this.hash.startsWith('#🔐')) {
|
||||
return html`
|
||||
<button class="w3-button w3-theme-d1" @click=${this.close_private_chat}>
|
||||
Close Chat
|
||||
</button>
|
||||
`;
|
||||
} else {
|
||||
return html`${this.hash}`;
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
if (
|
||||
!this.messages ||
|
||||
@@ -500,6 +525,7 @@ class TfTabNewsFeedElement extends LitElement {
|
||||
Mark All Read
|
||||
</button>`
|
||||
: undefined}
|
||||
${this.render_close_chat_button()}
|
||||
<tf-news
|
||||
id="news"
|
||||
whoami=${this.whoami}
|
||||
|
Reference in New Issue
Block a user