From f8e01c7c99856fb69455ba8117c862c58e0c30c3 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 16 Sep 2020 12:35:59 -0400 Subject: [PATCH] fix target for notification for daily_watch_remind type --- ui/component/notification/view.jsx | 31 ++++++++++++++++-------------- ui/constants/notifications.js | 1 + 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ui/component/notification/view.jsx b/ui/component/notification/view.jsx index cca1ffcbe..80cc451b6 100644 --- a/ui/component/notification/view.jsx +++ b/ui/component/notification/view.jsx @@ -1,11 +1,6 @@ // @flow -import { - NOTIFICATION_CREATOR_SUBSCRIBER, - NOTIFICATION_COMMENT, - NOTIFICATION_REPLY, - DAILY_WATCH_AVAILABLE, -} from 'constants/notifications'; +import * as NOTIFICATIONS from 'constants/notifications'; import * as PAGES from 'constants/pages'; import * as ICONS from 'constants/icons'; import React from 'react'; @@ -31,12 +26,20 @@ export default function Notification(props: Props) { const { notification, menuButton = false, doSeeNotifications } = props; const { push } = useHistory(); const { notification_rule, notification_parameters, is_seen, id } = notification; - const notificationTarget = - notification && notification_rule === DAILY_WATCH_AVAILABLE - ? `/$/${PAGES.CHANNELS_FOLLOWING}` - : notification_parameters.device.target; - const isCommentNotification = notification_rule === NOTIFICATION_COMMENT || notification_rule === NOTIFICATION_REPLY; + const isCommentNotification = + notification_rule === NOTIFICATIONS.NOTIFICATION_COMMENT || notification_rule === NOTIFICATIONS.NOTIFICATION_REPLY; const commentText = isCommentNotification && notification_parameters.dynamic.comment; + + let notificationTarget; + switch (notification_rule) { + case NOTIFICATIONS.DAILY_WATCH_AVAILABLE: + case NOTIFICATIONS.DAILY_WATCH_REMIND: + notificationTarget = `/$/${PAGES.CHANNELS_FOLLOWING}`; + break; + default: + notificationTarget = notification_parameters.device.target; + } + let notificationLink = formatLbryUrlForWeb(notificationTarget); let urlParams = new URLSearchParams(); if (isCommentNotification && notification_parameters.dynamic.hash) { @@ -54,13 +57,13 @@ export default function Notification(props: Props) { let icon; switch (notification_rule) { - case NOTIFICATION_CREATOR_SUBSCRIBER: + case NOTIFICATIONS.NOTIFICATION_CREATOR_SUBSCRIBER: icon = ; break; - case NOTIFICATION_COMMENT: + case NOTIFICATIONS.NOTIFICATION_COMMENT: icon = ; break; - case NOTIFICATION_REPLY: + case NOTIFICATIONS.NOTIFICATION_REPLY: icon = ; break; default: diff --git a/ui/constants/notifications.js b/ui/constants/notifications.js index 60555f464..61cb3da02 100644 --- a/ui/constants/notifications.js +++ b/ui/constants/notifications.js @@ -2,3 +2,4 @@ export const NOTIFICATION_CREATOR_SUBSCRIBER = 'creator_subscriber'; export const NOTIFICATION_COMMENT = 'comment'; export const NOTIFICATION_REPLY = 'comment-reply'; export const DAILY_WATCH_AVAILABLE = 'daily_watch_available'; +export const DAILY_WATCH_REMIND = 'daily_watch_remind';