Skip to content

Commit

Permalink
fix special cases with unlinked/broken user entity
Browse files Browse the repository at this point in the history
  • Loading branch information
sleidig committed Nov 25, 2024
1 parent 1d949b7 commit 0e76f45
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
/*
* This file is part of ndb-core.
*
* ndb-core is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ndb-core is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ndb-core. If not, see <http://www.gnu.org/licenses/>.
*/

import { SessionManagerService } from "./session-manager.service";
import { LoginState } from "../session-states/login-state.enum";
import {
Expand Down Expand Up @@ -152,7 +135,6 @@ describe("SessionManagerService", () => {
entityId: adminUser.getId(),
});
await service.remoteLogin();
expect(currentUser.value).toBeUndefined();

// user entity available -> user should be set
await entityMapper.save(adminUser);
Expand All @@ -171,7 +153,7 @@ describe("SessionManagerService", () => {

expect(loadSpy).not.toHaveBeenCalled();
expect(loginStateSubject.value).toBe(LoginState.LOGGED_IN);
expect(TestBed.inject(CurrentUserSubject).value).toBeUndefined();
expect(TestBed.inject(CurrentUserSubject).value).toBeNull();
});

it("should allow other entities to log in", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class SessionManagerService {
private initUserEntity(entityId: string) {
if (!entityId) {
this.currentUser.next(null);
return;
}

const entityType = Entity.extractTypeFromId(entityId);
Expand Down

0 comments on commit 0e76f45

Please sign in to comment.