group privacy implemented

This commit is contained in:
cube
2026-03-20 18:09:06 +00:00
parent 9d27cc2763
commit 7ddf77b1ba
3 changed files with 10 additions and 1 deletions

View File

@@ -267,7 +267,8 @@ def group_edit(gid):
if request.method == "POST":
name = request.form["name"]
desc = request.form["desc"]
db.execute("UPDATE groups SET group_name=(?), group_description=(?) WHERE id=(?)",(name, desc, gid))
privacy = request.form["privacy"]
db.execute("UPDATE groups SET group_name=(?), group_description=(?), public=(?) WHERE id=(?)",(name, desc, privacy, gid))
db.commit()
return redirect(url_for("manage.groups"))

View File

@@ -4,6 +4,8 @@
{% block content %}
{% for group in groups %}
{% if not g.user and group[3]==0 %}
{% else %}
<div class="heading big">{{group[1]}}</div>
<div class="maintext">
{{group[2]}}<br><br>
@@ -13,6 +15,7 @@
{% endfor %}
{% endif %}
</div>
{% endif %}
{% endfor %}
{% endblock %}

View File

@@ -22,8 +22,13 @@
<input name="name" id="name" value="{{group[1]}}" required><br>
<label for="desc">Description</label>
<textarea name="desc" id="desc">{{group[2]}}</textarea><br>
<input type="radio" id="public" name="privacy" value=1 {% if group[3]==1 %}checked{% endif %}>
<label for="public">Public</label><br>
<input type="radio" id="private" name="privacy" value=0 {% if group[3]==0 %}checked{% endif %}>
<label for="private">Private</label><br>
<input type="submit" value="Submit">
</form>
<a class="danger">Delete group</a> - WARNING: this action is permanent and irreversible. this will not delete any members contained within the group.
<hr>
{% endfor %}