mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 19:41:11 +00:00
Consistent use of plurals
This commit is contained in:
parent
7508ae9eae
commit
e54c563865
4 changed files with 11 additions and 20 deletions
|
@ -156,7 +156,6 @@ class ListItem(CollectionItemMixin, BookWyrmModel):
|
|||
self.book_list.updated_date = timezone.now()
|
||||
self.book_list.save(broadcast=False, update_fields=["updated_date"])
|
||||
|
||||
|
||||
def raise_not_deletable(self, viewer):
|
||||
"""the associated user OR the list owner can delete"""
|
||||
if self.book_list.user == viewer:
|
||||
|
|
|
@ -69,18 +69,17 @@ class Notification(BookWyrmModel):
|
|||
@classmethod
|
||||
@transaction.atomic
|
||||
def notify_list_item(cls, user, list_item):
|
||||
""" Group the notifications around the list items, not the user """
|
||||
"""Group the notifications around the list items, not the user"""
|
||||
related_user = list_item.user
|
||||
notification = cls.objects.filter(
|
||||
user=user,
|
||||
related_users=related_user,
|
||||
related_list_items__book_list=list_item.book_list,
|
||||
notification_type=Notification.ADD
|
||||
notification_type=Notification.ADD,
|
||||
).first()
|
||||
if not notification:
|
||||
notification = cls.objects.create(
|
||||
user=user,
|
||||
notification_type=Notification.ADD
|
||||
user=user, notification_type=Notification.ADD
|
||||
)
|
||||
notification.related_users.add(related_user)
|
||||
notification.related_list_items.add(list_item)
|
||||
|
@ -252,15 +251,9 @@ def notify_user_on_list_item_add(sender, instance, created, *args, **kwargs):
|
|||
# create a notification if somoene ELSE added to a local user's list
|
||||
if list_owner.local and list_owner != instance.user:
|
||||
# keep the related_user singular, group the items
|
||||
Notification.notify_list_item(
|
||||
list_owner,
|
||||
instance
|
||||
)
|
||||
Notification.notify_list_item(list_owner, instance)
|
||||
|
||||
if instance.book_list.group:
|
||||
for membership in instance.book_list.group.memberships.all():
|
||||
if membership.user != instance.user:
|
||||
Notification.notify_list_item(
|
||||
membership.user,
|
||||
instance
|
||||
)
|
||||
Notification.notify_list_item(membership.user, instance)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{% load utilities %}
|
||||
|
||||
{% block primary_link %}{% spaceless %}
|
||||
{{ notification.related_user.local_path }}
|
||||
{% url 'user-followers' request.user.localname %}
|
||||
{% endspaceless %}{% endblock %}
|
||||
|
||||
{% block icon %}
|
||||
|
@ -12,7 +12,6 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block description %}
|
||||
|
||||
{% if related_user_count == 1 %}
|
||||
{% blocktrans trimmed %}
|
||||
<a href="{{ related_user_link }}">{{ related_user }}</a> followed you
|
||||
|
@ -24,8 +23,7 @@
|
|||
{% endblocktrans %}
|
||||
{% else %}
|
||||
{% blocktrans trimmed %}
|
||||
<a href="{{ related_user_link }}">{{ related_user }}</a>,
|
||||
<a href="{{ second_user_link }}">{{ second_user }}</a>, and {{ other_user_display_count }} users followed you
|
||||
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_display_count }} others followed you
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{% load humanize %}
|
||||
{% related_status notification as related_status %}
|
||||
|
||||
{% with related_users=notification.related_users.all %}
|
||||
{% with related_users=notification.related_users.all.distinct %}
|
||||
{% with related_user_count=notification.related_users.count %}
|
||||
<div class="notification {% if notification.id in unread %}has-background-primary{% endif %}">
|
||||
<div class="columns is-mobile {% if notification.id in unread %}has-text-white{% else %}has-text-more-muted{% endif %}">
|
||||
|
@ -40,8 +40,8 @@
|
|||
|
||||
{% with related_user=related_users.first.display_name %}
|
||||
{% with related_user_link=related_users.first.local_path %}
|
||||
{% with second_user=related_users.all.1.display_name %}
|
||||
{% with second_user_link=related_users.all.1.local_path %}
|
||||
{% with second_user=related_users.1.display_name %}
|
||||
{% with second_user_link=related_users.1.local_path %}
|
||||
{% with other_user_count=related_user_count|add:"-1" %}
|
||||
{% with other_user_display_count=other_user_count|intcomma %}
|
||||
{% block description %}{% endblock %}
|
||||
|
@ -63,3 +63,4 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
|
|
Loading…
Reference in a new issue