forked from andyburke/autonomous.contact
fix: permission denied error and topic indicators
This commit is contained in:
parent
50dcb98e0d
commit
ce5cd81b10
3 changed files with 34 additions and 10 deletions
|
|
@ -375,9 +375,13 @@ async function poll_for_new_events() {
|
|||
});
|
||||
}
|
||||
|
||||
async function load_topic(topic_id) {
|
||||
async function load_active_topic() {
|
||||
const topic_id = document.body.dataset.topic;
|
||||
if (!topic_id) return;
|
||||
|
||||
const user = document.body.dataset.user ? JSON.parse(document.body.dataset.user) : null;
|
||||
if (!user) return;
|
||||
|
||||
const topic_chat_content = document.getElementById("topic-chat-content");
|
||||
|
||||
if (topic_polling_request_abort_controller) {
|
||||
|
|
@ -395,7 +399,6 @@ async function load_topic(topic_id) {
|
|||
|
||||
const topic = await topic_response.json();
|
||||
|
||||
topic_chat_content.dataset.topic_id = topic.id;
|
||||
topic_chat_content.innerHTML = "";
|
||||
|
||||
const topic_selectors = document.querySelectorAll("li.topic");
|
||||
|
|
@ -420,6 +423,5 @@ async function load_topic(topic_id) {
|
|||
await append_topic_events(events);
|
||||
poll_for_new_events();
|
||||
}
|
||||
document.addEventListener("topic_changed", ({ detail: { topic_id } }) => {
|
||||
load_topic(topic_id);
|
||||
});
|
||||
document.addEventListener("topic_changed", load_active_topic);
|
||||
document.addEventListener("user_logged_in", load_active_topic);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue