Skip to content

Commit

Permalink
Rollback changes on streams
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Jan 26, 2024
1 parent b2d1204 commit a770526
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,7 @@ export const useWebDAVAccountIntegrationsQuery = ({ enabled = true, ...options }
return subscribeToNotifyUser(`${uid}/webdav`, ({ type, account }) => {
switch (type) {
case 'changed':
queryClient.setQueryData<IWebdavAccountIntegration[]>(queryKey, (old = []) => {
const idx = old.findIndex((oldAccount) => oldAccount._id === account._id);

if (idx === -1) {
return [...old, account];
}

return [...old.slice(0, idx), account, ...old.slice(idx + 1)];
});
queryClient.invalidateQueries(queryKey);
break;

case 'removed':
Expand Down
6 changes: 2 additions & 4 deletions ee/packages/ddp-client/src/types/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type {
LicenseLimitKind,
ICustomUserStatus,
UserStatus,
IWebdavAccountIntegration,
IWebdavAccount,
} from '@rocket.chat/core-typings';
import type * as UiKit from '@rocket.chat/ui-kit';

Expand Down Expand Up @@ -158,9 +158,7 @@ export interface StreamerEvents {
{ key: `${string}/force_logout`; args: [] },
{
key: `${string}/webdav`;
args: [
{ type: 'changed'; account: IWebdavAccountIntegration } | { type: 'removed'; account: { _id: IWebdavAccountIntegration['_id'] } },
];
args: [{ type: 'changed'; account: Partial<IWebdavAccount> } | { type: 'removed'; account: { _id: IWebdavAccount['_id'] } }];
},
{ key: `${string}/e2ekeyRequest`; args: [string, string] },
{ key: `${string}/notification`; args: [INotificationDesktop] },
Expand Down
6 changes: 3 additions & 3 deletions packages/core-services/src/events/Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import type {
ILivechatVisitor,
LicenseLimitKind,
ICustomUserStatus,
IWebdavAccountIntegration,
IWebdavAccount,
} from '@rocket.chat/core-typings';
import type * as UiKit from '@rocket.chat/ui-kit';

Expand Down Expand Up @@ -84,11 +84,11 @@ export type EventSignatures = {
data:
| {
type: 'changed';
account: IWebdavAccountIntegration;
account: Partial<IWebdavAccount>;
}
| {
type: 'removed';
account: { _id: IWebdavAccountIntegration['_id'] };
account: { _id: IWebdavAccount['_id'] };
},
): void;
'notify.e2e.keyRequest'(rid: string, data: IRoom['e2eKeyId']): void;
Expand Down

0 comments on commit a770526

Please sign in to comment.