fix: update email_content when grouping notifications (#35656)

This commit is contained in:
Muhammad Adeel Tajamul
2024-10-18 17:02:03 +05:00
committed by GitHub
parent 2bb4728ab8
commit 42febb62ce
2 changed files with 14 additions and 0 deletions

View File

@@ -80,6 +80,7 @@ class NewCommentGrouper(BaseNotificationGrouper):
context['grouped'] = True
context['replier_name_list'].append(new_notification.content_context['replier_name'])
context['grouped_count'] += 1
context['email_content'] = new_notification.content_context.get('email_content', '')
return context

View File

@@ -88,6 +88,19 @@ class TestNewCommentGrouper(unittest.TestCase):
self.assertEqual(len(updated_context['replier_name_list']), 3)
self.assertEqual(updated_context['grouped_count'], 3)
def test_group_email_content(self):
"""
Tests email_content in content_context when grouping notification
"""
self.old_notification.content_context['email_content'] = 'old content'
self.new_notification.content_context = {
'email_content': 'new content',
'replier_name': 'user_2',
}
content_context = NewCommentGrouper().group(self.new_notification, self.old_notification)
self.assertIn('email_content', content_context)
self.assertEqual(content_context['email_content'], 'new content')
class TestGroupUserNotifications(unittest.TestCase):
"""