From 86003c73a3ac2a8e2e70b0adb3345ae86eb8ad3e Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 8 Sep 2020 16:56:48 -0400 Subject: [PATCH] handle comment reply notifications --- flow-typed/notification.js | 1 + ui/component/notification/view.jsx | 14 +++++++++----- ui/constants/notifications.js | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/flow-typed/notification.js b/flow-typed/notification.js index c46c554a0..04b0eef22 100644 --- a/flow-typed/notification.js +++ b/flow-typed/notification.js @@ -22,6 +22,7 @@ declare type WebNotification = { }, dynamic: { comment_author: string, + reply_author: string, hash: string, claim_title: string, comment?: string, diff --git a/ui/component/notification/view.jsx b/ui/component/notification/view.jsx index 309c27940..392451aec 100644 --- a/ui/component/notification/view.jsx +++ b/ui/component/notification/view.jsx @@ -1,6 +1,6 @@ // @flow -import { NOTIFICATION_CREATOR_SUBSCRIBER, NOTIFICATION_COMMENT } from 'constants/notifications'; +import { NOTIFICATION_CREATOR_SUBSCRIBER, NOTIFICATION_COMMENT, NOTIFICATION_REPLY } from 'constants/notifications'; import * as ICONS from 'constants/icons'; import React from 'react'; import classnames from 'classnames'; @@ -26,10 +26,11 @@ export default function Notification(props: Props) { const { push } = useHistory(); const { notification_rule, notification_parameters, is_seen, id } = notification; const notificationTarget = notification && notification_parameters.device.target; - const commentText = notification_rule === NOTIFICATION_COMMENT && notification_parameters.dynamic.comment; + const isCommentNotification = notification_rule === NOTIFICATION_COMMENT || notification_rule === NOTIFICATION_REPLY; + const commentText = isCommentNotification && notification_parameters.dynamic.comment; let notificationLink = formatLbryUrlForWeb(notificationTarget); let urlParams = new URLSearchParams(); - if (notification_rule === NOTIFICATION_COMMENT && notification_parameters.dynamic.hash) { + if (isCommentNotification && notification_parameters.dynamic.hash) { urlParams.append('lc', notification_parameters.dynamic.hash); } @@ -50,6 +51,9 @@ export default function Notification(props: Props) { case NOTIFICATION_COMMENT: icon = ; break; + case NOTIFICATION_REPLY: + icon = ; + break; default: icon = ; } @@ -100,11 +104,11 @@ export default function Notification(props: Props) {
{icon}
- {notification_rule !== NOTIFICATION_COMMENT && ( + {!isCommentNotification && (
{notification_parameters.device.title}
)} - {notification_rule === NOTIFICATION_COMMENT && commentText ? ( + {isCommentNotification && commentText ? ( <>
{notification_parameters.device.title}
{commentText}
diff --git a/ui/constants/notifications.js b/ui/constants/notifications.js index f11d20a7b..cf2e48cd7 100644 --- a/ui/constants/notifications.js +++ b/ui/constants/notifications.js @@ -1,2 +1,3 @@ export const NOTIFICATION_CREATOR_SUBSCRIBER = 'creator_subscriber'; export const NOTIFICATION_COMMENT = 'comment'; +export const NOTIFICATION_REPLY = 'comment-reply';