add: ability to ip block users from their profile
This commit is contained in:
parent
a799c777ea
commit
0163391380
12 changed files with 241 additions and 20 deletions
|
@ -528,7 +528,7 @@
|
|||
("width" "24")
|
||||
("height" "24")
|
||||
("viewBox" "0 0 24 24")
|
||||
("style" "fill: var(--color-green)")
|
||||
("style" "fill: var(--online)")
|
||||
(circle
|
||||
("cx" "12")
|
||||
("cy" "12")
|
||||
|
@ -541,7 +541,7 @@
|
|||
("width" "24")
|
||||
("height" "24")
|
||||
("viewBox" "0 0 24 24")
|
||||
("style" "fill: var(--color-yellow)")
|
||||
("style" "fill: var(--idle)")
|
||||
(circle
|
||||
("cx" "12")
|
||||
("cy" "12")
|
||||
|
@ -554,7 +554,7 @@
|
|||
("width" "24")
|
||||
("height" "24")
|
||||
("viewBox" "0 0 24 24")
|
||||
("style" "fill: hsl(0, 0%, 50%)")
|
||||
("style" "fill: var(--offline)")
|
||||
(circle
|
||||
("cx" "12")
|
||||
("cy" "12")
|
||||
|
@ -611,7 +611,8 @@
|
|||
(text "{%- endif %}")
|
||||
(div
|
||||
("style" "display: none;")
|
||||
(text "{{ self::theme_color(color=user.settings.theme_color_surface, css=\"color-surface\") }} {{ self::theme_color(color=user.settings.theme_color_text, css=\"color-text\") }} {{ self::theme_color(color=user.settings.theme_color_text_link, css=\"color-link\") }} {{ self::theme_color(color=user.settings.theme_color_lowered, css=\"color-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_text_lowered, css=\"color-text-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_super_lowered, css=\"color-super-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_raised, css=\"color-raised\") }} {{ self::theme_color(color=user.settings.theme_color_text_raised, css=\"color-text-raised\") }} {{ self::theme_color(color=user.settings.theme_color_super_raised, css=\"color-super-raised\") }} {{ self::theme_color(color=user.settings.theme_color_primary, css=\"color-primary\") }} {{ self::theme_color(color=user.settings.theme_color_text_primary, css=\"color-text-primary\") }} {{ self::theme_color(color=user.settings.theme_color_primary_lowered, css=\"color-primary-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_secondary, css=\"color-secondary\") }} {{ self::theme_color(color=user.settings.theme_color_text_secondary, css=\"color-text-secondary\") }} {{ self::theme_color(color=user.settings.theme_color_secondary_lowered, css=\"color-secondary-lowered\") }} {% if user.permissions|has_supporter -%}")
|
||||
(text "{{ self::theme_color(color=user.settings.theme_color_surface, css=\"color-surface\") }} {{ self::theme_color(color=user.settings.theme_color_text, css=\"color-text\") }} {{ self::theme_color(color=user.settings.theme_color_text_link, css=\"color-link\") }} {{ self::theme_color(color=user.settings.theme_color_lowered, css=\"color-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_text_lowered, css=\"color-text-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_super_lowered, css=\"color-super-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_raised, css=\"color-raised\") }} {{ self::theme_color(color=user.settings.theme_color_text_raised, css=\"color-text-raised\") }} {{ self::theme_color(color=user.settings.theme_color_super_raised, css=\"color-super-raised\") }} {{ self::theme_color(color=user.settings.theme_color_primary, css=\"color-primary\") }} {{ self::theme_color(color=user.settings.theme_color_text_primary, css=\"color-text-primary\") }} {{ self::theme_color(color=user.settings.theme_color_primary_lowered, css=\"color-primary-lowered\") }} {{ self::theme_color(color=user.settings.theme_color_secondary, css=\"color-secondary\") }} {{ self::theme_color(color=user.settings.theme_color_text_secondary, css=\"color-text-secondary\") }} {{ self::theme_color(color=user.settings.theme_color_secondary_lowered, css=\"color-secondary-lowered\") }}
|
||||
{{ self::theme_color(color=user.settings.theme_color_online, css=\"online\") }} {{ self::theme_color(color=user.settings.theme_color_idle, css=\"idle\") }} {{ self::theme_color(color=user.settings.theme_color_offline, css=\"offline\") }} {% if user.permissions|has_supporter -%}")
|
||||
(style
|
||||
(text "{{ user.settings.theme_custom_css|remove_script_tags|safe }}"))
|
||||
(text "{%- endif %}"))
|
||||
|
|
|
@ -219,12 +219,24 @@
|
|||
(text "{{ icon \"user-minus\" }}")
|
||||
(span
|
||||
(text "{{ text \"auth:action.unfollow\" }}")))
|
||||
(button
|
||||
("onclick" "toggle_block_user()")
|
||||
("class" "lowered red")
|
||||
(text "{{ icon \"shield\" }}")
|
||||
(span
|
||||
(text "{{ text \"auth:action.block\" }}")))
|
||||
(div
|
||||
("class" "dropdown")
|
||||
(button
|
||||
("onclick" "trigger('atto::hooks::dropdown', [event])")
|
||||
("exclude" "dropdown")
|
||||
("class" "lowered red")
|
||||
(icon_class (text "chevron-down") (text "dropdown-arrow"))
|
||||
(str (text "auth:action.block")))
|
||||
(div
|
||||
("class" "inner")
|
||||
(button
|
||||
("onclick" "toggle_block_user()")
|
||||
(icon (text "shield"))
|
||||
(str (text "auth:action.block")))
|
||||
(button
|
||||
("onclick" "ip_block_user()")
|
||||
(icon (text "wifi"))
|
||||
(str (text "auth:action.ip_block")))))
|
||||
(text "{% else %}")
|
||||
(button
|
||||
("onclick" "toggle_block_user()")
|
||||
|
@ -342,6 +354,30 @@
|
|||
res.message,
|
||||
]);
|
||||
});
|
||||
};
|
||||
|
||||
globalThis.ip_block_user = async () => {
|
||||
if (
|
||||
!(await trigger(\"atto::confirm\", [
|
||||
\"Are you sure you would like to do this?\",
|
||||
]))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(
|
||||
\"/api/v1/auth/user/{{ profile.id }}/block_ip\",
|
||||
{
|
||||
method: \"POST\",
|
||||
},
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger(\"atto::toast\", [
|
||||
res.ok ? \"success\" : \"error\",
|
||||
res.message,
|
||||
]);
|
||||
});
|
||||
};"))))
|
||||
(text "{%- endif %} {% if not profile.settings.private_communities or is_self or is_helper %}")
|
||||
(div
|
||||
|
|
|
@ -446,6 +446,30 @@
|
|||
("class" "button lowered small")
|
||||
(icon (text "external-link"))
|
||||
(span (str (text "requests:action.view_profile"))))))
|
||||
(text "{% endfor %}")))
|
||||
|
||||
; ip blocks
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card flex items-center gap-2 small")
|
||||
(text "{{ icon \"wifi\" }}")
|
||||
(span
|
||||
(text "{{ text \"settings:label.ips\" }}")))
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(text "{% for ip in ipblocks %}")
|
||||
(div
|
||||
("class" "card secondary flex flex-wrap gap-2 items-center justify-between")
|
||||
(span
|
||||
(text "Block from: ") (span ("class" "date") (text "{{ ip.created }}")))
|
||||
(div
|
||||
("class" "flex gap-2")
|
||||
(button
|
||||
("onclick" "trigger('me::remove_ip_block', ['{{ ip.id }}'])")
|
||||
("class" "lowered small red")
|
||||
(icon (text "x"))
|
||||
(span (str (text "auth:action.unblock"))))))
|
||||
(text "{% endfor %}")))))
|
||||
(div
|
||||
("class" "w-full flex flex-col gap-2 hidden")
|
||||
|
@ -1734,6 +1758,35 @@
|
|||
description: \"Hover state for secondary buttons.\",
|
||||
},
|
||||
],
|
||||
// online indicator
|
||||
[[], \"\", \"divider\"],
|
||||
[
|
||||
[\"theme_color_online\", \"Online indicator (online)\"],
|
||||
\"{{ profile.settings.theme_color_online }}\",
|
||||
\"color\",
|
||||
{
|
||||
description:
|
||||
\"The green dot next to the name of online users.\",
|
||||
},
|
||||
],
|
||||
[
|
||||
[\"theme_color_idle\", \"Online indicator (idle)\"],
|
||||
\"{{ profile.settings.theme_color_idle }}\",
|
||||
\"color\",
|
||||
{
|
||||
description:
|
||||
\"The yellow dot next to the name of online users.\",
|
||||
},
|
||||
],
|
||||
[
|
||||
[\"theme_color_offline\", \"Online indicator (offline)\"],
|
||||
\"{{ profile.settings.theme_color_offline }}\",
|
||||
\"color\",
|
||||
{
|
||||
description:
|
||||
\"The grey next to the name of online users.\",
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
if (can_use_custom_css) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue