Skip to content

Commit

Permalink
regression: notify user properly on logout (#32920)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored Jul 26, 2024
1 parent 776fc1e commit b55869b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/meteor/app/api/server/v1/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ API.v1.addRoute(
throw new Meteor.Error('error-invalid-user-id', 'Invalid user id');
}

void notifyOnUserChange({ clientAction: 'updated', id: this.userId, diff: { 'services.resume.loginTokens': [] } });
void notifyOnUserChange({ clientAction: 'updated', id: userId, diff: { 'services.resume.loginTokens': [] } });

return API.v1.success({
message: `User ${userId} has been logged out!`,
Expand Down
3 changes: 3 additions & 0 deletions apps/meteor/server/lib/resetUserE2EKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { api } from '@rocket.chat/core-services';
import { Subscriptions, Users, Rooms } from '@rocket.chat/models';
import { Meteor } from 'meteor/meteor';

import { notifyOnUserChange } from '../../app/lib/server/lib/notifyListener';
import * as Mailer from '../../app/mailer/server/api';
import { settings } from '../../app/settings/server';
import { i18n } from './i18n';
Expand Down Expand Up @@ -76,5 +77,7 @@ export async function resetUserE2EEncriptionKey(uid: string, notifyUser: boolean
// Force the user to logout, so that the keys can be generated again
await Users.unsetLoginTokens(uid);

void notifyOnUserChange({ clientAction: 'updated', id: uid, diff: { 'services.resume.loginTokens': [] } });

return true;
}

0 comments on commit b55869b

Please sign in to comment.