Group Clops Feature Branch (#10360)
Co-authored-by: DS Boyce <260543580+ds-boyce@users.noreply.github.com> Co-authored-by: Samuel Newman <mozzius@protonmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,7 @@ export type NotificationReason =
|
||||
| 'reply'
|
||||
| 'quote'
|
||||
| 'chat-message'
|
||||
| 'chat-reaction'
|
||||
| 'starterpack-joined'
|
||||
| 'like-via-repost'
|
||||
| 'repost-via-repost'
|
||||
@@ -44,7 +45,7 @@ export type NotificationReason =
|
||||
export type NotificationPayload =
|
||||
| undefined
|
||||
| {
|
||||
reason: Exclude<NotificationReason, 'chat-message'>
|
||||
reason: Exclude<NotificationReason, 'chat-message' | 'chat-reaction'>
|
||||
uri: string
|
||||
subject: string
|
||||
recipientDid: string
|
||||
@@ -55,6 +56,12 @@ export type NotificationPayload =
|
||||
messageId: string
|
||||
recipientDid: string
|
||||
}
|
||||
| {
|
||||
reason: 'chat-reaction'
|
||||
convoId: string
|
||||
messageId: string
|
||||
recipientDid: string
|
||||
}
|
||||
|
||||
const DEFAULT_HANDLER_OPTIONS = {
|
||||
shouldShowBanner: false,
|
||||
@@ -192,8 +199,11 @@ export function useNotificationsHandler() {
|
||||
const handleNotification = (payload?: NotificationPayload) => {
|
||||
if (!payload) return
|
||||
|
||||
if (payload.reason === 'chat-message') {
|
||||
logger.debug(`useNotificationsHandler: handling chat message`, {
|
||||
if (
|
||||
payload.reason === 'chat-message' ||
|
||||
payload.reason === 'chat-reaction'
|
||||
) {
|
||||
logger.debug(`useNotificationsHandler: handling chat notification`, {
|
||||
payload,
|
||||
})
|
||||
|
||||
@@ -270,7 +280,8 @@ export function useNotificationsHandler() {
|
||||
logger.debug('useNotificationsHandler: incoming', {e, payload})
|
||||
|
||||
if (
|
||||
payload.reason === 'chat-message' &&
|
||||
(payload.reason === 'chat-message' ||
|
||||
payload.reason === 'chat-reaction') &&
|
||||
payload.recipientDid === currentAccount?.did
|
||||
) {
|
||||
const shouldAlert = payload.convoId !== currentConvoId
|
||||
@@ -341,7 +352,8 @@ export function useNotificationsHandler() {
|
||||
// Whenever there's a stored payload, that means we had to switch accounts before handling the notification.
|
||||
// Whenever currentAccount changes, we should try to handle it again.
|
||||
if (
|
||||
storedAccountSwitchPayload?.reason === 'chat-message' &&
|
||||
(storedAccountSwitchPayload?.reason === 'chat-message' ||
|
||||
storedAccountSwitchPayload?.reason === 'chat-reaction') &&
|
||||
currentAccount?.did === storedAccountSwitchPayload.recipientDid
|
||||
) {
|
||||
handleNotification(storedAccountSwitchPayload)
|
||||
@@ -429,6 +441,7 @@ export function notificationToURL(payload: NotificationPayload): string | null {
|
||||
return `/profile/${urip.host}`
|
||||
}
|
||||
case 'chat-message':
|
||||
case 'chat-reaction':
|
||||
// should be handled separately
|
||||
return null
|
||||
case 'verified':
|
||||
|
||||
Reference in New Issue
Block a user