fix: clean up login tokens in users.deactivateidle#40569
Conversation
🦋 Changeset detectedLatest commit: b92ec26 The changes in this PR will be included in the next version bump. This PR includes changesets to release 41 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/meteor/app/api/server/v1/users.ts">
<violation number="1" location="apps/meteor/app/api/server/v1/users.ts:435">
P1: Notifications are sent from a pre-update snapshot, so concurrent logins/activity can cause false `active:false` / token-cleared updates for users who were not actually deactivated.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Re-trigger cubic
| ids.forEach((_id) => { | ||
| void notifyOnUserChange({ | ||
| clientAction: 'updated', | ||
| id: _id, | ||
| diff: { 'services.resume.loginTokens': [], 'active': false }, | ||
| }); | ||
| }); |
There was a problem hiding this comment.
P1: Notifications are sent from a pre-update snapshot, so concurrent logins/activity can cause false active:false / token-cleared updates for users who were not actually deactivated.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/app/api/server/v1/users.ts, line 435:
<comment>Notifications are sent from a pre-update snapshot, so concurrent logins/activity can cause false `active:false` / token-cleared updates for users who were not actually deactivated.</comment>
<file context>
@@ -426,9 +426,20 @@ API.v1.addRoute(
+
const { modifiedCount: count } = await Users.setActiveNotLoggedInAfterWithRole(lastLoggedIn, role, false);
+ ids.forEach((_id) => {
+ void notifyOnUserChange({
+ clientAction: 'updated',
</file context>
| ids.forEach((_id) => { | |
| void notifyOnUserChange({ | |
| clientAction: 'updated', | |
| id: _id, | |
| diff: { 'services.resume.loginTokens': [], 'active': false }, | |
| }); | |
| }); | |
| await Promise.all( | |
| ids.map(async (_id) => { | |
| const user = await Users.findOneById(_id, { projection: { active: 1 } }); | |
| if (!user || user.active) { | |
| return; | |
| } | |
| void notifyOnUserChange({ | |
| clientAction: 'updated', | |
| id: _id, | |
| diff: { 'services.resume.loginTokens': [], 'active': false }, | |
| }); | |
| }), | |
| ); |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-7.13.8 #40569 +/- ##
=================================================
Coverage ? 67.90%
=================================================
Files ? 3445
Lines ? 113908
Branches ? 20835
=================================================
Hits ? 77345
Misses ? 34444
Partials ? 2119
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Backport of #40496