forked from mirrors/bookwyrm
add button for non-owner members to leave group
This commit is contained in:
parent
eed9d44cfd
commit
680e547c8b
3 changed files with 21 additions and 4 deletions
|
@ -10,8 +10,9 @@
|
||||||
|
|
||||||
{% block searchresults %}
|
{% block searchresults %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
<div class="mb-2">
|
||||||
{% include "groups/members.html" with group=group %}
|
{% include "groups/members.html" with group=group %}
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2 class="title is-5">Lists</h2>
|
<h2 class="title is-5">Lists</h2>
|
||||||
{% if not lists %}
|
{% if not lists %}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
{% load utilities %}
|
{% load utilities %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
|
{% load bookwyrm_group_tags %}
|
||||||
|
|
||||||
<h2 class="title is-5">Group Members</h2>
|
<h2 class="title is-5">Group Members</h2>
|
||||||
<p class="subtitle is-6">{% trans "Members can add and remove books on a group's book lists" %}</p>
|
<p class="subtitle is-6">{% trans "Members can add and remove books on a group's book lists" %}</p>
|
||||||
|
@ -30,3 +31,18 @@
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if group.user != request.user and group|is_member:request.user %}
|
||||||
|
<form action="{% url 'remove-group-member' %}" method="POST" class="my-4">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="hidden" name="group" value="{{ group.id }}">
|
||||||
|
<input type="hidden" name="user" value="{{ user.username }}">
|
||||||
|
<button class="button is-small is-danger is-light" type="submit">
|
||||||
|
{% if show_username %}
|
||||||
|
{% blocktrans with username=user.localname %}Remove @{{ username }}{% endblocktrans %}
|
||||||
|
{% else %}
|
||||||
|
{% trans "Remove self from group" %}
|
||||||
|
{% endif %}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
|
@ -194,7 +194,7 @@ def remove_member(request):
|
||||||
|
|
||||||
memberships = models.GroupMember.objects.filter(group=group)
|
memberships = models.GroupMember.objects.filter(group=group)
|
||||||
model = apps.get_model("bookwyrm.Notification", require_ready=True)
|
model = apps.get_model("bookwyrm.Notification", require_ready=True)
|
||||||
notification_type = "LEAVE" if "self_removal" in request.POST and request.POST["self_removal"] else "REMOVE"
|
notification_type = "LEAVE" if user == request.user else "REMOVE"
|
||||||
# let the other members know about it
|
# let the other members know about it
|
||||||
for membership in memberships:
|
for membership in memberships:
|
||||||
member = membership.user
|
member = membership.user
|
||||||
|
|
Loading…
Reference in a new issue