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

feat: notifications for missed chat messages #754

Merged
merged 11 commits into from
Jul 29, 2023

Conversation

LomyW
Copy link
Contributor

@LomyW LomyW commented Jul 26, 2023

Description

A user should get notifications from Lern-Fair if the user missed some chat messages

What was done?

  • implemented webhook
  • added notification actions for 1:1 chats and group chats

Tests

  • tested if a concreteNotification is created after a notification is triggered by TalkJS
  • tested in-app notification if preference is set

@LomyW LomyW requested a review from timidak July 26, 2023 11:56
@realmayus realmayus temporarily deployed to backend-feat-739-webhoo-vqfxqs July 26, 2023 11:57 Inactive
@@ -412,6 +412,31 @@ const _notificationActions = {
appointment: sampleAppointment,
},
},
missed_one_on_one_chat_message: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

action for missed 1:1 messages

loginToken: '',
},
},
missed_course_chat_message: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

action for missed group chat messages

}

const notificationAction = chatType === ChatType.ONE_ON_ONE ? 'missed_one_on_one_chat_message' : 'missed_course_chat_message';
await Notification.actionTaken(userToNotify, notificationAction, notificationContext);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont need to iterate over each participant of a group conversation, because TalkJS itselfs triggers notifications for each participant of the group chat.

Copy link
Member

@Jonasdoubleyou Jonasdoubleyou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice overall!

common/notification/actions.ts Outdated Show resolved Hide resolved
common/notification/actions.ts Outdated Show resolved Hide resolved
web/controllers/chatNotificationController/index.ts Outdated Show resolved Hide resolved
web/controllers/chatNotificationController/util.ts Outdated Show resolved Hide resolved
web/controllers/chatNotificationController/util.ts Outdated Show resolved Hide resolved
web/server.ts Outdated Show resolved Hide resolved
} catch (error) {
if (error instanceof InvalidSignatureError) {
logger.info('Invalid Signature');
res.status(401).send({ error: 'Unauthorized' });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing return / else

@realmayus realmayus temporarily deployed to backend-feat-739-webhoo-gtvzrc July 28, 2023 12:34 Inactive
@realmayus realmayus temporarily deployed to backend-feat-739-webhoo-pzjwjx July 28, 2023 12:34 Inactive
@Jonasdoubleyou
Copy link
Member

merging this as potentially conflicting with #702, won't be deployed so just create a followup PR if necessary :)

@Jonasdoubleyou Jonasdoubleyou merged commit 817e2d9 into master Jul 29, 2023
2 checks passed
@Jonasdoubleyou Jonasdoubleyou deleted the feat/739-webhook-for-missed-chat-notification branch July 29, 2023 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants