From 1dd3b18fe720be9df9b06346cd1276fabd5f1294 Mon Sep 17 00:00:00 2001 From: 1aerostorm Date: Sat, 14 Dec 2024 02:46:00 +0300 Subject: [PATCH] Private groups - queueWatch WebSocket, small fix (WIP) --- src/components/modules/MessagesTopCenter.scss | 1 + src/components/pages/Messages.jsx | 10 +++++----- src/utils/NotifyApiClient.js | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/modules/MessagesTopCenter.scss b/src/components/modules/MessagesTopCenter.scss index d1302f4f..e1f10b66 100644 --- a/src/components/modules/MessagesTopCenter.scss +++ b/src/components/modules/MessagesTopCenter.scss @@ -48,6 +48,7 @@ @media screen and (max-width: 39.9375em) { .GroupDropdown { left: 10px !important; + position: fixed; } } diff --git a/src/components/pages/Messages.jsx b/src/components/pages/Messages.jsx index 65014d92..df75c236 100644 --- a/src/components/pages/Messages.jsx +++ b/src/components/pages/Messages.jsx @@ -34,7 +34,7 @@ import { getProfileImage, } from 'app/utils/NormalizeProfile'; import { normalizeContacts, normalizeMessages, cacheMyOwnMsg } from 'app/utils/Normalizators'; import { fitToPreview } from 'app/utils/ImageUtils'; import { notificationSubscribe, notificationSubscribeWs, notifyWsPing, - notificationShallowUnsubscribe, notificationTake, queueWatch, sendOffchainMessage, notifyWsHost, notifyUrl } from 'app/utils/NotifyApiClient'; + notificationShallowUnsubscribe, notificationTake, queueWatchWs, sendOffchainMessage, notifyWsHost, notifyUrl } from 'app/utils/NotifyApiClient'; import { flash, unflash } from 'app/components/elements/messages/FlashTitle'; import { addShortcut } from 'app/utils/app/ShortcutUtils' import { hideSplash } from 'app/utils/app/SplashUtils' @@ -252,17 +252,17 @@ class Messages extends React.Component { const {username} = this.props if (!username) { - console.log('watchGroup -', to, ' - no username') + console.log('watchGroupWs -', to, ' - no username') return false } try { window.errorLogs.push({ details: { watchGroup: to } }) - await queueWatch(username, to) - console.log('watchGroup - ', to) + await queueWatchWs(username, to) + console.log('watchGroupWs - ', to) window.errorLogs.push({ details: { watchGroup: 'ok' } }) return true } catch (err) { - console.error('watchGroup - ', to, err) + console.error('watchGroupWs - ', to, err) this.notifyErrorsInc(30, err, {watchGroup: notifyUrl()}) } return false diff --git a/src/utils/NotifyApiClient.js b/src/utils/NotifyApiClient.js index 63d75436..28d722e7 100644 --- a/src/utils/NotifyApiClient.js +++ b/src/utils/NotifyApiClient.js @@ -334,9 +334,10 @@ export async function queueWatchWs(account, group, sidKey = '__subscriber_id') { if (!notifyWsHost()) return null const xSession = notifySession() return await new Promise(async (resolve, reject) => { - await notifyWsSend('queues/subscribe', { + await notifyWsSend('queues/watch', { account, 'X-Session': xSession, + subscriber_id: window[sidKey], objects: { [group]: { type: 'group',