add: ability to mask your account when creating a question

This commit is contained in:
trisua 2025-07-01 14:50:19 -04:00
parent 973373426a
commit 0634819278
11 changed files with 125 additions and 79 deletions

View file

@ -917,18 +917,18 @@ media_theme_pref();
if (option.input_element_type === "checkbox") {
into_element.innerHTML += `<div class="card flex items-center gap-2">
<input
type="checkbox"
onchange="window.set_setting_field${id_key}('${option.key}', event.target.checked)"
placeholder="${option.key}"
name="${option.key}"
id="${option.key}"
${option.value === "true" ? "checked" : ""}
class="w-content"
/>
<input
type="checkbox"
onchange="window.set_setting_field${id_key}('${option.key}', event.target.checked)"
placeholder="${option.key}"
name="${option.key}"
id="${option.key}"
${option.value === "true" ? "checked" : ""}
class="w-content"
/>
<label for="${option.key}"><b>${option.label.replaceAll("_", " ")}</b></label>
</div>`;
<label for="${option.key}"><b>${option.label.replaceAll("_", " ")}</b></label>
</div>`;
return;
}

View file

@ -342,25 +342,34 @@
},
);
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("achievement", (_, name) => {
return new Promise((resolve) => {
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,
]);
}
resolve();
});
});
});
self.define("achievement_link", async (_, name, href) => {
await self.achievement(name);
Turbo.visit(href);
});
self.define("report", (_, asset, asset_type) => {