add: allow mods to remove associations

This commit is contained in:
trisua 2025-08-10 22:26:13 -04:00
parent bcee3f7763
commit ba319130d2
4 changed files with 64 additions and 12 deletions

View file

@ -1350,9 +1350,9 @@
(text "Listening to "))
(text "{{ other_user.connections.Spotify[1].data.artist }}")))
(text "{%- endif %} {%- endmacro %} {% macro user_plate(user, show_menu=false, show_kick=false, secondary=false) -%}")
(text "{%- endif %} {%- endmacro %} {% macro user_plate(user, show_menu=false, show_kick=false, secondary=false, full=false) -%}")
(div
("class" "flex gap_2 items_center card tiny user_plate {% if secondary -%}secondary{%- endif %}")
("class" "flex gap_2 items_center card tiny user_plate {% if secondary -%}secondary{%- endif %} {% if full -%} w_full {%- endif %}")
(a
("href" "/@{{ user.username }}")
(text "{{ self::avatar(username=user.username, size=\"42px\", selector_type=\"username\") }}"))

View file

@ -84,7 +84,7 @@
const ui = await ns(\"ui\");
const element = document.getElementById(\"mod_options\");
globalThis.profile_request = async (do_confirm, path, body) => {
globalThis.profile_request = async (do_confirm, path, body = null, headers = { \"Content-Type\": \"application/json\" }, method = \"POST\") => {
if (do_confirm) {
if (
!(await trigger(\"atto::confirm\", [
@ -96,11 +96,9 @@
}
fetch(`/api/v1/auth/user/{{ profile.id }}/${path}`, {
method: \"POST\",
headers: {
\"Content-Type\": \"application/json\",
},
body: JSON.stringify(body),
method,
headers: headers != null ? headers : undefined,
body: body != null ? JSON.stringify(body) : undefined,
})
.then((res) => res.json())
.then((res) => {
@ -265,9 +263,15 @@
(span
(text "{{ text \"mod_panel:label.associations\" }}"))))
(div
("class" "card lowered flex flex_wrap gap_2")
("class" "card flex flex_wrap gap_4 flex_collapse")
(text "{% for user in associations -%}")
(text "{{ components::user_plate(user=user, show_menu=false) }}")
(div
("class" "flex flex_row gap_2 items_center card small secondary")
(text "{{ components::user_plate(user=user, show_menu=false, secondary=true, full=true) }}")
(button
("class" "small square red lowered")
("onclick" "profile_request(true, 'associations/{{ user.id }}', null, null, 'DELETE')")
(icon (text "x"))))
(text "{%- endfor %}")))
(text "{% if invite -%}")
(div