From e74ea6ca699077d47bdb690ee6a16a71a0af85a9 Mon Sep 17 00:00:00 2001 From: cube Date: Fri, 20 Mar 2026 19:27:01 +0000 Subject: [PATCH] toggle blog post privacy --- README.md | 5 ++--- myriad/blog.py | 16 ++++++++++++++++ myriad/templates/blog/blog.html | 2 +- myriad/templates/page.html | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0551757..d858ce4 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,10 @@ flask app for plurals to publicly share member lists logged in users are presumed to all be admins with distinction only between being logged in and not +in the blog view, member privacy outweighs individual post privacy. if a private member makes a public post, it will not show up in the public feed. however, if that member switches to public, their public posts will all become publicly viewable (but private posts will remain private). + # assorted todo -- privacy settings for blog posts -- add delete button to blog posts on main feed -- show blog posts in edit member section with a delete button - page theme edit inside the user (below user theme?) - apply page theme edits - add blinkies and stamps sections to member pages diff --git a/myriad/blog.py b/myriad/blog.py index 1fd73ad..0c2c021 100644 --- a/myriad/blog.py +++ b/myriad/blog.py @@ -57,3 +57,19 @@ def delete(pid, location): else: return redirect(url_for("home.page", mid=location)) +@bp.route("/toggle//") +@login_required +def toggle(pid, location): + db = get_db() + post = db.execute("SELECT * FROM blog WHERE id=(?)",(pid,)).fetchone() + if post[5] == 0: + db.execute("UPDATE blog SET public=(?) WHERE id=(?)",(1, pid)) + db.commit() + else: + db.execute("UPDATE blog SET public=(?) WHERE id=(?)",(0, pid)) + db.commit() + + if location == "blog": + return redirect(url_for("blog.blog")) + else: + return redirect(url_for("home.page", mid=location)) \ No newline at end of file diff --git a/myriad/templates/blog/blog.html b/myriad/templates/blog/blog.html index a0083e9..b242d8e 100644 --- a/myriad/templates/blog/blog.html +++ b/myriad/templates/blog/blog.html @@ -24,7 +24,7 @@
{% if g.user %} - {% if post[5]==0 %}Private{% else %}Public{% endif %} | Delete post + {% if post[5]==0 %}Private{% else %}Public{% endif %} | Toggle privacy | Delete post {% endif %} {% endif %} diff --git a/myriad/templates/page.html b/myriad/templates/page.html index 3f240ab..c76055b 100644 --- a/myriad/templates/page.html +++ b/myriad/templates/page.html @@ -30,7 +30,7 @@
{{post[4]|safe}}
- {% if g.user %}Delete post{% endif %} + Toggle privacy | {% if g.user %}Delete post{% endif %} {% endif %} {% endfor %}