add: don't allow poll creator to vote

add: unfollow user when you block them
add: force other user to unfollow you by blocking them
add: leave receiver communities when you block them
This commit is contained in:
trisua 2025-06-05 16:23:57 -04:00
parent 5a330b7a18
commit 460e87e90e
11 changed files with 165 additions and 17 deletions

View file

@ -1343,6 +1343,7 @@
window.POLL_OPTION_B = \"\";
window.POLL_OPTION_C = \"\";
window.POLL_OPTION_D = \"\";
window.POLL_EXPIRES = null;
window.get_poll_data = () => {
if (!POLL_OPTION_A && !POLL_OPTION_B) {
@ -1353,11 +1354,16 @@
return [false, \"At least 2 options are required for a poll\"];
}
if (POLL_EXPIRES < 0) {
return [false, \"Polls cannot time travel\"];
}
return [true, {
option_a: POLL_OPTION_A,
option_b: POLL_OPTION_B,
option_c: POLL_OPTION_C,
option_d: POLL_OPTION_D
option_d: POLL_OPTION_D,
expires: POLL_EXPIRES,
}];
}"))
@ -1395,7 +1401,12 @@
(div
("class" "card flex flex-col gap-2")
(b (text "Option D"))
(input ("type" "text") ("placeholder" "option D") ("onchange" "window.POLL_OPTION_D = event.target.value"))))
(input ("type" "text") ("placeholder" "option D") ("onchange" "window.POLL_OPTION_D = event.target.value")))
(div
("class" "card flex flex-col gap-2")
(b (text "Expires"))
(input ("type" "date") ("onchange" "window.POLL_EXPIRES = event.target.valueAsDate.getTime() - new Date().getTime()"))))
(hr)
(div
("class" "flex justify-between")
@ -1414,9 +1425,13 @@
("class" "card tertiary w-full flex flex-col gap-2")
(text "{% set total = poll[0].votes_a + poll[0].votes_b + poll[0].votes_c + poll[0].votes_d %}")
(text "{% if poll[1] -%}")
(text "{% if poll[1] or poll[2] or user and user.id == poll[0].owner -%}")
; already voted, show results
(text "{% if poll[1] %}")
(span ("class" "fade") (text "You've already voted!"))
(text "{% elif poll[2] %}")
(span ("class" "fade") (text "Poll ended!"))
(text "{% endif %}")
; option a
(div
@ -1484,5 +1499,12 @@
; show expiration date + totals
(div
("class" "flex w-full flex-wrap gap-2")
(span ("class" "notification chip") (text "{{ total }} votes"))))
(span ("class" "notification chip") (text "{{ total }} votes"))
(span
("class" "notification chip")
(text "Expires in ")
(span
("class" "poll_date")
("data-created" "{{ poll[0].created }}")
("data-expires" "{{ poll[0].expires }}")))))
(text "{%- endmacro %}")

View file

@ -855,7 +855,7 @@
(script
("type" "application/json")
("id" "settings_json")
(text "{{ profile.settings|json_encode()|safe }}"))
(text "{{ profile.settings|json_encode()|remove_script_tags|safe }}"))
(script
(text "setTimeout(() => {
const ui = ns(\"ui\");

View file

@ -91,6 +91,7 @@
atto.disconnect_observers();
atto.remove_false_options();
atto.clean_date_codes();
atto.clean_poll_date_codes();
atto.link_filter();
atto[\"hooks::scroll\"](document.body, document.documentElement);