mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-03 23:06:40 +00:00
fix group members not being able to delete items on group lists
This commit is contained in:
parent
7db2af89dd
commit
603a9dc25c
2 changed files with 4 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
""" make a list of books!! """
|
""" make a list of books!! """
|
||||||
|
from bookwyrm.models.group import GroupMember
|
||||||
from dataclasses import field
|
from dataclasses import field
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
@ -9,7 +10,7 @@ from bookwyrm.settings import DOMAIN
|
||||||
from .activitypub_mixin import CollectionItemMixin, OrderedCollectionMixin
|
from .activitypub_mixin import CollectionItemMixin, OrderedCollectionMixin
|
||||||
from .base_model import BookWyrmModel
|
from .base_model import BookWyrmModel
|
||||||
from . import fields
|
from . import fields
|
||||||
|
from .group import GroupMember
|
||||||
|
|
||||||
CurationType = models.TextChoices(
|
CurationType = models.TextChoices(
|
||||||
"Curation",
|
"Curation",
|
||||||
|
@ -115,7 +116,7 @@ class ListItem(CollectionItemMixin, BookWyrmModel):
|
||||||
if self.book_list.user == viewer:
|
if self.book_list.user == viewer:
|
||||||
return
|
return
|
||||||
# group members can delete items in group lists
|
# group members can delete items in group lists
|
||||||
is_group_member = models.GroupMember.objects.filter(group=self.book_list.group, user=viewer).exists()
|
is_group_member = GroupMember.objects.filter(group=self.book_list.group, user=viewer).exists()
|
||||||
if is_group_member:
|
if is_group_member:
|
||||||
return
|
return
|
||||||
super().raise_not_deletable(viewer)
|
super().raise_not_deletable(viewer)
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if list.user == request.user or list.curation == 'open' and item.user == request.user %}
|
{% if list.user == request.user or list.curation == 'open' and item.user == request.user or list.group|is_member:request.user %}
|
||||||
<form name="remove-book" method="post" action="{% url 'list-remove-book' list.id %}" class="card-footer-item">
|
<form name="remove-book" method="post" action="{% url 'list-remove-book' list.id %}" class="card-footer-item">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="item" value="{{ item.id }}">
|
<input type="hidden" name="item" value="{{ item.id }}">
|
||||||
|
|
Loading…
Reference in a new issue