Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Batch email notifications #276

Merged
merged 25 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2c780c8
[chore] Basic implementation
Dhanus3133 Jun 4, 2024
949ea24
[chore] Updated changes
Dhanus3133 Jun 6, 2024
305d6c8
[chore] Add tests
Dhanus3133 Jun 7, 2024
0e54696
Merge branch 'master' into feat/batch-email
Dhanus3133 Jun 7, 2024
58bdc9d
[chore] Update Readme
Dhanus3133 Jun 8, 2024
4abc717
[chore] New changes
Dhanus3133 Jun 15, 2024
caf3031
Merge branch 'master' into feat/batch-email
Dhanus3133 Jun 15, 2024
233a1e7
[chore] Improvements
Dhanus3133 Jun 17, 2024
69365bb
[chore] Fix cache delete
Dhanus3133 Jun 17, 2024
9d38db1
[chore] New changes
Dhanus3133 Jun 18, 2024
01182c4
[chore] Updates
Dhanus3133 Jun 18, 2024
483df00
[chore] Add extra tests
Dhanus3133 Jun 18, 2024
68a1604
[fix] Tests
Dhanus3133 Jun 21, 2024
6757f7b
[chore] Bump changes
Dhanus3133 Jul 6, 2024
a826d5e
[feat] Automatically open notification widget
Dhanus3133 Jul 6, 2024
7a55502
[chore] Open notifications widget with #notifications
Dhanus3133 Jul 10, 2024
67de9e5
[tests] Fixed test_without_batch_email_notification
nemesifier Jul 15, 2024
12288de
[fix] Updated
Dhanus3133 Jul 17, 2024
3760173
[chore] Update tests
Dhanus3133 Jul 17, 2024
2087b3e
Merge branch 'gsoc24' into feat/batch-email
Dhanus3133 Jul 17, 2024
56ac4cf
[chore] Update email title notifications count
Dhanus3133 Jul 17, 2024
12d19e2
[QA] Checks
Dhanus3133 Jul 17, 2024
49087b2
[chore] Update batch_email txt
Dhanus3133 Jul 18, 2024
a34920a
[fix] Use email_message instead of message
Dhanus3133 Jul 24, 2024
65dbdc1
[chore] Add email content tests
Dhanus3133 Jul 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openwisp_notifications/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
logger = logging.getLogger(__name__)

EXTRA_DATA = app_settings.get_config()['USE_JSONFIELD']
EMAIL_BATCH_INTERVAL = app_settings.EMAIL_BATCH_INTERVAL
Dhanus3133 marked this conversation as resolved.
Show resolved Hide resolved

User = get_user_model()

Expand Down Expand Up @@ -205,6 +204,7 @@ def send_email_notification(sender, instance, created, **kwargs):
'email_id': instance.recipient.email,
},
)
EMAIL_BATCH_INTERVAL = app_settings.EMAIL_BATCH_INTERVAL
Dhanus3133 marked this conversation as resolved.
Show resolved Hide resolved

if cache_data['last_email_sent_time'] and EMAIL_BATCH_INTERVAL > 0:
Dhanus3133 marked this conversation as resolved.
Show resolved Hide resolved
# Case 1: Batch email sending logic
Expand Down
4 changes: 2 additions & 2 deletions openwisp_notifications/tests/test_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from django.core.exceptions import ImproperlyConfigured
from django.db.models.signals import post_migrate, post_save
from django.template import TemplateDoesNotExist
from django.test import TransactionTestCase, override_settings
from django.test import TransactionTestCase
from django.urls import reverse
from django.utils import timezone
from django.utils.timesince import timesince
Expand Down Expand Up @@ -984,7 +984,7 @@ def test_batch_email_notification_with_call_to_action(self, mock_send_email):
self.assertIn('View all Notifications', mail.outbox[1].body)
self.assertNotIn('Test Notification', mail.outbox[1].body)

Dhanus3133 marked this conversation as resolved.
Show resolved Hide resolved
@override_settings(EMAIL_BATCH_INTERVAL=0)
@patch.object(app_settings, 'EMAIL_BATCH_INTERVAL', 0)
def test_without_batch_email_notification(self):
self.notification_options.update(
{
Expand Down
Loading