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:\"]);
|
||||
|
|
|
@ -31,6 +31,22 @@
|
|||
(text "{{ icon \"user-plus\" }}")
|
||||
(span
|
||||
(text "{{ text \"chats:action.add_someone\" }}")))
|
||||
; mute/unmute
|
||||
(button
|
||||
("class" "lowered small {% if channel.id in user.channel_mutes -%} hidden {%- endif %}")
|
||||
("ui_ident" "channel.mute:{{ channel.id }}")
|
||||
("onclick" "mute_channel('{{ channel.id }}')")
|
||||
(icon (text "bell-off"))
|
||||
(span
|
||||
(str (text "chats:action.mute"))))
|
||||
(button
|
||||
("class" "lowered small {% if not channel.id in user.channel_mutes -%} hidden {%- endif %}")
|
||||
("ui_ident" "channel.unmute:{{ channel.id }}")
|
||||
("onclick" "mute_channel('{{ channel.id }}', false)")
|
||||
(icon (text "bell-ring"))
|
||||
(span
|
||||
(str (text "chats:action.unmute"))))
|
||||
; ...
|
||||
(text "{%- endif %}")
|
||||
(button
|
||||
("class" "lowered small")
|
||||
|
|
|
@ -113,6 +113,12 @@
|
|||
("style" "color: var(--color-primary)")
|
||||
("class" "flex items-center")
|
||||
(text "{{ icon \"badge-check\" }}"))
|
||||
(text "{%- endif %} {% if user.permissions|has_staff_badge -%}")
|
||||
(span
|
||||
("title" "Staff")
|
||||
("style" "color: var(--color-primary);")
|
||||
("class" "flex items-center")
|
||||
(text "{{ icon \"shield-user\" }}"))
|
||||
(text "{%- endif %}"))
|
||||
(text "{%- endif %} {%- endmacro %} {% macro repost(repost, post, owner, secondary=false, community=false, show_community=true, can_manage_post=false) -%}")
|
||||
(div
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue