diff --git a/Pipfile b/Pipfile index 8db9cfe..9853f9c 100644 --- a/Pipfile +++ b/Pipfile @@ -27,4 +27,3 @@ inscriptis = "*" lxml = "*" [dev-packages] - diff --git a/brutaldon/forms.py b/brutaldon/forms.py index dfc6bd1..84db4cd 100644 --- a/brutaldon/forms.py +++ b/brutaldon/forms.py @@ -38,6 +38,7 @@ class PreferencesForm(forms.ModelForm): "click_to_load", "lightbox", "filter_notifications", + "bundle_notifications", "poll_frequency", ] diff --git a/brutaldon/migrations/0023_preference_bundle_notifications.py b/brutaldon/migrations/0023_preference_bundle_notifications.py new file mode 100644 index 0000000..303aed5 --- /dev/null +++ b/brutaldon/migrations/0023_preference_bundle_notifications.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.7 on 2019-11-04 23:53 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('brutaldon', '0022_auto_20190506_0938'), + ] + + operations = [ + migrations.AddField( + model_name='preference', + name='bundle_notifications', + field=models.BooleanField(default=False, help_text='Collapse together boosts or likes of the same toot in the notifications page.'), + ), + ] diff --git a/brutaldon/models.py b/brutaldon/models.py index b63f4fe..4a64cf7 100644 --- a/brutaldon/models.py +++ b/brutaldon/models.py @@ -65,6 +65,12 @@ class Preference(models.Model): default=False, help_text=_("""Exclude boosts and favs from your notifications."""), ) + bundle_notifications = models.BooleanField( + default=False, + help_text=_( + """Collapse together boosts or likes of the same toot in the notifications page.""" + ), + ) class Account(models.Model): diff --git a/brutaldon/templates/comma.html b/brutaldon/templates/comma.html new file mode 100644 index 0000000..c73893f --- /dev/null +++ b/brutaldon/templates/comma.html @@ -0,0 +1,5 @@ +{% if not forloop.first %} + {% if forloop.last %}, and + {% else %}, + {% endif %} +{% endif %} diff --git a/brutaldon/templates/main/notifications.html b/brutaldon/templates/main/notifications.html index d6ab510..14bb9cc 100644 --- a/brutaldon/templates/main/notifications.html +++ b/brutaldon/templates/main/notifications.html @@ -3,7 +3,7 @@ {% load taglinks %} {% block title %} -Brutaldon ({{ own_acct.username }}) - Notifications timelime + Brutaldon ({{ own_acct.username }}) - Notifications timelime {% endblock %} {% comment %} @@ -21,73 +21,99 @@ mastodon.notifications()[0] {% block content %} -

Your notifications timeline

-{% for note in notes %} -{% if note.type == 'mention' %} -

- {{ note.account.display_name }} - ({{ note.account.acct }}) - mentioned you. -

-
-{% include "main/toot_partial.html" with toot=note.status reblog=False %} - -{% elif note.type == 'reblog' %} -

- {{ note.account.display_name }} - ({{ note.account.acct }}) - boosted your toot. - ( - {{ note.created_at |humane_time }} - ) -

-{% include "main/toot_partial.html" with toot=note.status reblog=True reblog_by=note.account.acct reblog_icon=note.account.avatar_static %} - -{% elif note.type == 'favourite' %} -

- {{ note.account.display_name }} - ({{ note.account.acct }}) - favorited your toot. - ( - {{ note.created_at |humane_time }} - ) -

-{% include "main/toot_partial.html" with toot=note.status %} - -{% elif note.type == 'follow' %} -
-
-

- -

-
-
-
- {{ note.account.display_name }} - ({{ note.account.acct }}) - followed you. - ( - {{ note.created_at |humane_time }} - ) -
-
-
- -{% elif note.type == 'poll' %} -

A poll you created or voted in has ended.

- {% include "main/toot_partial.html" with toot=note.status %} - -{% endif %} -{% endfor %} +

Your notifications timeline

+ {% for group in groups %} + {% if bundle_notifications and group.0.type in bundleable %} + {% if group.0.type == 'favourite' %} +

+ {% for account in group.accounts %} + {% include "comma.html" %}{{ account.display_name }} + ({{ account.acct }}) + {% endfor %} + favorited your toot. +

+ {% include "main/toot_partial.html" with toot=group.0.status %} + + {% elif group.0.type == 'reblog' %} +

+ {% for account in group.accounts %} + {% include "comma.html" %}{{ account.display_name }} + ({{ account.acct }}) + {% endfor %} + boosted your toot. +

+ {% include "main/toot_partial.html" with toot=group.0.status reblog=True reblog_by=group.0.account.acct reblog_icon=group.0.account.avatar_static %} + + {% endif %} + {% else %} + {% for note in group %} + {% if note.type == 'mention' %} +

+ {{ note.account.display_name }} + ({{ note.account.acct }}) + mentioned you. +

+
+ {% include "main/toot_partial.html" with toot=note.status reblog=False %} + + {% elif note.type == 'reblog' %} +

+ {{ note.account.display_name }} + ({{ note.account.acct }}) + boosted your toot. + ( + {{ note.created_at |humane_time }} + ) +

+ {% include "main/toot_partial.html" with toot=note.status reblog=True reblog_by=note.account.acct reblog_icon=note.account.avatar_static %} + + {% elif note.type == 'favourite' %} +

+ {{ note.account.display_name }} + ({{ note.account.acct }}) + favorited your toot. + ( + {{ note.created_at |humane_time }} + ) +

+ {% include "main/toot_partial.html" with toot=note.status %} + + {% elif note.type == 'follow' %} +
+
+

+ +

+
+
+
+ {{ note.account.display_name }} + ({{ note.account.acct }}) + followed you. + ( + {{ note.created_at |humane_time }} + ) +
+
+
+ + {% elif note.type == 'poll' %} +

A poll you created or voted in has ended.

+ {% include "main/toot_partial.html" with toot=note.status %} + + {% endif %} + {% endfor %} + {% endif %} + {% endfor %} - + {% endblock %} diff --git a/brutaldon/templates/setup/settings.html b/brutaldon/templates/setup/settings.html index a8f9e22..2e09f20 100644 --- a/brutaldon/templates/setup/settings.html +++ b/brutaldon/templates/setup/settings.html @@ -125,6 +125,23 @@ +
+
+ +
+
+

+ {{ form.bundle_notifications.help_text }} +

+
+
+ +
+
+