From ab0171716c18ea632d05a32bc29a67ff9b048785 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Tue, 18 Jul 2023 14:12:27 +0530 Subject: [PATCH 1/2] fix: fix decryptConversation (#554) --- packages/restapi/src/lib/chat/helpers/inbox.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/restapi/src/lib/chat/helpers/inbox.ts b/packages/restapi/src/lib/chat/helpers/inbox.ts index 4df219e51..b243e2b78 100644 --- a/packages/restapi/src/lib/chat/helpers/inbox.ts +++ b/packages/restapi/src/lib/chat/helpers/inbox.ts @@ -167,7 +167,8 @@ export const decryptConversation = async (options: DecryptConverationType) => { } = options || {}; let otherPeer: IUser; let signatureValidationPubliKey: string; // To do signature verification it depends on who has sent the message - for (let message of messages) { + for (let i = 0; i < messages.length; i++) { + const message = messages[i]; let gotOtherPeer = false; if (message.encType !== 'PlainText') { if (!pgpPrivateKey) { @@ -182,7 +183,7 @@ export const decryptConversation = async (options: DecryptConverationType) => { } else { signatureValidationPubliKey = connectedUser.publicKey; } - message = await decryptAndVerifyMessage( + messages[i] = await decryptAndVerifyMessage( message, signatureValidationPubliKey, pgpPrivateKey From d56740f03e067727c80821b8e6862818ecd1f8af Mon Sep 17 00:00:00 2001 From: Monalisha Mishra <42746736+mishramonalisha76@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:24:50 +0530 Subject: [PATCH 2/2] Fix/bugs (#555) * fix: fixed subscription status bug * fix: added moment in dependecy --- packages/demoreact/src/app/ChatWidgetTest.tsx | 2 +- packages/uiweb/package.json | 3 ++- .../sidebar/notificationSidebar/InboxNotificationFeedList.tsx | 1 - .../sidebar/notificationSidebar/NotificationFeedList.tsx | 2 +- .../notifcation/notificationMainStateContext.tsx | 4 +--- .../uiweb/src/lib/hooks/notifications/useFetchNotification.ts | 2 -- 6 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/demoreact/src/app/ChatWidgetTest.tsx b/packages/demoreact/src/app/ChatWidgetTest.tsx index 00d26860b..1fe239289 100644 --- a/packages/demoreact/src/app/ChatWidgetTest.tsx +++ b/packages/demoreact/src/app/ChatWidgetTest.tsx @@ -18,7 +18,6 @@ export const ChatWidgetTest = () => { (async()=>{ const user = await PushAPI.user.get({ account: account, env }); const pvtkey = null; - console.log(user) if (user?.encryptedPrivateKey) { const response = await PushAPI.chat.decryptPGPKey({ encryptedPGPPrivateKey: (user as IUser).encryptedPrivateKey, @@ -35,6 +34,7 @@ export const ChatWidgetTest = () => { const onClose = () => { console.log('in here widget') }; + return ( { setPaginateLoading(false); } }; - return ( = ({ const { onSubscribeToChannel } = useOnSubscribeToChannel(); const { signer} = useContext(ChatAndNotificationPropsContext); const isSubscribedFn = (channel: string) => { - return subscriptionStatus.get(channel); + return !!subscriptionStatus.get(channel); }; return ( <> diff --git a/packages/uiweb/src/lib/context/chatAndNotification/notifcation/notificationMainStateContext.tsx b/packages/uiweb/src/lib/context/chatAndNotification/notifcation/notificationMainStateContext.tsx index d66f890d4..af1a1b04e 100644 --- a/packages/uiweb/src/lib/context/chatAndNotification/notifcation/notificationMainStateContext.tsx +++ b/packages/uiweb/src/lib/context/chatAndNotification/notifcation/notificationMainStateContext.tsx @@ -44,9 +44,7 @@ const NotificationMainStateContextProvider = ({ const [spamNotifsFeed, setSpamNotifsFeed] = useState( {} as NotificationFeedsType ); - const [subscriptionStatus, setSubscriptionStatus] = useState< - Map - >({} as Map); + const [subscriptionStatus, setSubscriptionStatus] = useState>(new Map()); const [searchedNotifications, setSearchedNotifications] = useState(null); diff --git a/packages/uiweb/src/lib/hooks/notifications/useFetchNotification.ts b/packages/uiweb/src/lib/hooks/notifications/useFetchNotification.ts index 9d6b2662f..7a0dab907 100644 --- a/packages/uiweb/src/lib/hooks/notifications/useFetchNotification.ts +++ b/packages/uiweb/src/lib/hooks/notifications/useFetchNotification.ts @@ -23,7 +23,6 @@ const useFetchNotification = () => { async ({ page,limit,spam =false}: fetchNotification) => { setLoading(true); try { - console.log(env) const results = await PushAPI.user.getFeeds({ user: account, // user address in CAIP raw: true, @@ -33,7 +32,6 @@ const useFetchNotification = () => { limit: limit }); const parsedResponse = convertReponseToParsedArray(results); - console.log(parsedResponse) const modifiedNotifObj = Object.fromEntries( parsedResponse.map((e: any) => [`notif${e.sid}`, e]) );