fix: journal privacy
This commit is contained in:
parent
57a69eea50
commit
97b7e873ed
6 changed files with 95 additions and 15 deletions
|
@ -272,7 +272,34 @@
|
|||
("class" "flex flex-col gap-2 card")
|
||||
(text "{{ note.content|markdown|safe }}"))
|
||||
|
||||
(span (text "Last updated: ") (span ("class" "date") (text "{{ note.edited }}")))
|
||||
(div
|
||||
("class" "flex w-full justify-between gap-2")
|
||||
(span (text "Last updated: ") (span ("class" "date") (text "{{ note.edited }}")))
|
||||
(text "{% if user and user.id == owner.id -%}")
|
||||
(button
|
||||
("class" "small")
|
||||
("onclick" "{% if journal.privacy == \"Public\" -%}
|
||||
trigger('atto::copy_text', ['{{ config.host }}/@{{ owner.username }}/{{ journal.title }}/{{ note.title }}'])
|
||||
{%- else -%}
|
||||
prompt_make_public();
|
||||
trigger('atto::copy_text', ['{{ config.host }}/@{{ owner.username }}/{{ journal.title }}/{{ note.title }}'])
|
||||
{%- endif %}")
|
||||
(icon (text "share"))
|
||||
(str (text "general:label.share")))
|
||||
|
||||
(script
|
||||
(text "globalThis.prompt_make_public = async () => {
|
||||
if (
|
||||
!(await trigger(\"atto::confirm\", [
|
||||
\"Would you like to make this journal public? This is required for others to view this note.\",
|
||||
]))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
change_journal_privacy({ target: { selectedOptions: [{ value: \"Public\" }] }, preventDefault: () => {} });
|
||||
}"))
|
||||
(text "{%- endif %}"))
|
||||
(text "{%- endif %}")
|
||||
(text "{%- endif %}")))
|
||||
(style
|
||||
|
@ -431,8 +458,8 @@
|
|||
|
||||
globalThis.change_journal_privacy = async (e) => {
|
||||
e.preventDefault();
|
||||
const selected = event.target.selectedOptions[0];
|
||||
fetch(\"/api/v1/journals/{{ selected_journal }}/privacy\", {
|
||||
const selected = e.target.selectedOptions[0];
|
||||
fetch(\"/api/v1/journals/{% if journal -%} {{ journal.id }} {%- else -%} {{ selected_journal }} {%- endif %}/privacy\", {
|
||||
method: \"POST\",
|
||||
headers: {
|
||||
\"Content-Type\": \"application/json\",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue