add: channel mutes
This commit is contained in:
parent
02f3d08926
commit
884a89904e
17 changed files with 149 additions and 7 deletions
|
@ -210,6 +210,30 @@
|
|||
});
|
||||
};
|
||||
|
||||
globalThis.mute_channel = async (id, mute = true) => {
|
||||
await trigger(\"atto::debounce\", [\"channels::mute\"]);
|
||||
fetch(`/api/v1/channels/${id}/mute`, {
|
||||
method: mute ? \"POST\" : \"DELETE\",
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger(\"atto::toast\", [
|
||||
res.ok ? \"success\" : \"error\",
|
||||
res.message,
|
||||
]);
|
||||
|
||||
if (res.ok) {
|
||||
if (mute) {
|
||||
document.querySelector(`[ui_ident=channel\\\\.mute\\\\:${id}]`).classList.add(\"hidden\");
|
||||
document.querySelector(`[ui_ident=channel\\\\.unmute\\\\:${id}]`).classList.remove(\"hidden\");
|
||||
} else {
|
||||
document.querySelector(`[ui_ident=channel\\\\.mute\\\\:${id}]`).classList.remove(\"hidden\");
|
||||
document.querySelector(`[ui_ident=channel\\\\.unmute\\\\:${id}]`).classList.add(\"hidden\");
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
globalThis.update_channel_title = async (id) => {
|
||||
await trigger(\"atto::debounce\", [\"channels::update_title\"]);
|
||||
const title = await trigger(\"atto::prompt\", [\"New channel title:\"]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue