toggle blog post privacy
This commit is contained in:
@@ -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
|
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
|
# 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?)
|
- page theme edit inside the user (below user theme?)
|
||||||
- apply page theme edits
|
- apply page theme edits
|
||||||
- add blinkies and stamps sections to member pages
|
- add blinkies and stamps sections to member pages
|
||||||
|
|||||||
@@ -57,3 +57,19 @@ def delete(pid, location):
|
|||||||
else:
|
else:
|
||||||
return redirect(url_for("home.page", mid=location))
|
return redirect(url_for("home.page", mid=location))
|
||||||
|
|
||||||
|
@bp.route("/toggle/<pid>/<location>")
|
||||||
|
@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))
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<br class="clear" />
|
<br class="clear" />
|
||||||
{% if g.user %}
|
{% if g.user %}
|
||||||
{% if post[5]==0 %}<b style="color:red;">Private</b>{% else %}<b style="color:green;">Public</b>{% endif %} | <a href="{{url_for('blog.delete', pid=post[0], location='blog')}}" class="danger">Delete post</a>
|
{% if post[5]==0 %}<b style="color:red;">Private</b>{% else %}<b style="color:green;">Public</b>{% endif %} | <a href="{{url_for('blog.toggle',pid=post[0], location='blog')}}">Toggle privacy</a> | <a href="{{url_for('blog.delete', pid=post[0], location='blog')}}" class="danger">Delete post</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
{{post[4]|safe}}
|
{{post[4]|safe}}
|
||||||
</div>
|
</div>
|
||||||
{% if g.user %}<a href="{{url_for('blog.delete', pid=post[0], location=member[0])}}" class="danger">Delete post</a>{% endif %}
|
<a href="{{url_for('blog.toggle',pid=post[0], location=member[0])}}">Toggle privacy</a> | {% if g.user %}<a href="{{url_for('blog.delete', pid=post[0], location=member[0])}}" class="danger">Delete post</a>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user