add: policy achievements

This commit is contained in:
trisua 2025-06-30 18:49:41 -04:00
parent d90b08720a
commit 973373426a
7 changed files with 83 additions and 13 deletions

View file

@ -1135,15 +1135,13 @@
(icon (text "rabbit"))
(str (text "general:link.reference")))
(a
("href" "{{ config.policies.terms_of_service }}")
("class" "button")
(button
("onclick" "trigger('me::achievement', ['OpenTos']); Turbo.visit('{{ config.policies.terms_of_service }}')")
(icon (text "heart-handshake"))
(text "Terms of service"))
(a
("href" "{{ config.policies.privacy }}")
("class" "button")
(button
("onclick" "trigger('me::achievement', ['OpenPrivacyPolicy']); Turbo.visit('{{ config.policies.privacy }}')")
(icon (text "cookie"))
(text "Privacy policy"))
(b ("class" "title") (str (text "general:label.account")))

View file

@ -1522,7 +1522,7 @@
[
[
\"hide_associated_blocked_users\",
\"Hide users that you've blocked on your other accounts from timelines.\",
\"Hide users that you've blocked on your other accounts from timelines\",
],
\"{{ profile.settings.hide_associated_blocked_users }}\",
\"checkbox\",

View file

@ -342,6 +342,27 @@
},
);
self.define("achievement", async (_, name) => {
fetch("/api/v1/auth/user/me/achievement", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
name,
}),
})
.then((res) => res.json())
.then((res) => {
if (!res.ok) {
trigger("atto::toast", [
res.ok ? "success" : "error",
res.message,
]);
}
});
});
self.define("report", (_, asset, asset_type) => {
window.open(
`/mod_panel/file_report?asset=${asset}&asset_type=${asset_type}`,