Skip to content

Commit

Permalink
[Auth] Fix tenantId field when setting user via updateCurrentUser (#5577
Browse files Browse the repository at this point in the history
)

* Fix tenantId field when setting user via updateCurrentUser

* Add changeset
  • Loading branch information
sam-gc committed Oct 5, 2021
1 parent 3e920c8 commit e456d00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/twelve-scissors-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/auth": patch
---

Fix bug where `user.tenantId` wasn't being carried over in `updateCurrentUser` function
4 changes: 3 additions & 1 deletion packages/auth/src/core/user/user_impl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ describe('core/user/user_impl', () => {
phoneNumber: 'number',
photoURL: 'photo',
emailVerified: false,
isAnonymous: true
isAnonymous: true,
tenantId: 'tenant-id'
});

const newAuth = await testAuth();
Expand All @@ -272,6 +273,7 @@ describe('core/user/user_impl', () => {
expect(copy.stsTokenManager).not.to.eq(user.stsTokenManager);
expect(copy.toJSON()).to.eql(user.toJSON());
expect(copy.auth).to.eq(newAuth);
expect(copy.tenantId).to.eq('tenant-id');
});
});
});
1 change: 1 addition & 0 deletions packages/auth/src/core/user/user_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class UserImpl implements UserInternal {
this.phoneNumber = opt.phoneNumber || null;
this.photoURL = opt.photoURL || null;
this.isAnonymous = opt.isAnonymous || false;
this.tenantId = opt.tenantId || null;
this.metadata = new UserMetadata(
opt.createdAt || undefined,
opt.lastLoginAt || undefined
Expand Down

0 comments on commit e456d00

Please sign in to comment.