feat: added notifications when response is endorsed or answered (#34082)

* feat: added notification when response is endorsed or answered

* test: added and fixed test cases

* fix: fixed lint errors

* refactor: changed method name for readibility

* feat: added notification when my response is endorsed

* test: fixed failed test cases
This commit is contained in:
ayesha waris
2024-02-01 13:33:16 +05:00
committed by GitHub
parent abb4b0e37c
commit 9f136a4149
8 changed files with 191 additions and 8 deletions

View File

@@ -132,6 +132,34 @@ COURSE_NOTIFICATION_TYPES = {
},
'email_template': '',
},
'response_endorsed_on_thread': {
'notification_app': 'discussion',
'name': 'response_endorsed_on_thread',
'is_core': True,
'info': '',
'non_editable': [],
'content_template': _('<{p}><{strong}>{username}</{strong}> response has been endorsed in your post '
'<{strong}>{post_title}</{strong}></{p}>'),
'content_context': {
'post_title': 'Post title',
'username': 'Response author name',
},
'email_template': '',
'filters': [FILTER_AUDIT_EXPIRED_USERS_WITH_NO_ROLE]
},
'response_endorsed': {
'notification_app': 'discussion',
'name': 'response_endorsed',
'is_core': True,
'info': '',
'non_editable': [],
'content_template': _('<{p}><Your response has been endorsed <{strong}>{post_title}</{strong}></{p}>'),
'content_context': {
'post_title': 'Post title',
},
'email_template': '',
'filters': [FILTER_AUDIT_EXPIRED_USERS_WITH_NO_ROLE]
}
}
COURSE_NOTIFICATION_APPS = {

View File

@@ -21,7 +21,7 @@ log = logging.getLogger(__name__)
NOTIFICATION_CHANNELS = ['web', 'push', 'email']
# Update this version when there is a change to any course specific notification type or app.
COURSE_NOTIFICATION_CONFIG_VERSION = 5
COURSE_NOTIFICATION_CONFIG_VERSION = 6
def get_course_notification_preference_config():

View File

@@ -236,7 +236,9 @@ class UserNotificationPreferenceAPITest(ModuleStoreTestCase):
'new_comment',
'new_response',
'response_on_followed_post',
'comment_on_followed_post'
'comment_on_followed_post',
'response_endorsed_on_thread',
'response_endorsed'
],
'notification_types': {
'core': {