Skip to content

Commit

Permalink
reset current user preferences when unsetting user.
Browse files Browse the repository at this point in the history
Doesn't affect normal logout as it reloads the whole page, but js tests unset the user to simulate logout
  • Loading branch information
notbakaneko committed Aug 9, 2024
1 parent cf33e84 commit 831e61d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
4 changes: 2 additions & 2 deletions resources/js/core/user/user-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export default class UserPreferences {
setUser(user?: CurrentUserJson) {
this.user = user;

if (user != null && !this.updatingOptions) {
this.current = user?.user_preferences;
if (!this.updatingOptions) {
this.current = user?.user_preferences ?? structuredClone(defaultUserPreferencesJson);
}
}

Expand Down
8 changes: 0 additions & 8 deletions tests/karma/beatmapset-search-filters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ describe('BeatmapsetSearchFilters', () => {
let subject: BeatmapsetSearchFilters;

describe('.query', () => {
beforeAll(() => {
core.setCurrentUser(testCurrentUserJson);
});

afterAll(() => {
core.setCurrentUser({ id: undefined });
});

beforeEach(() => {
subject = new BeatmapsetSearchFilters('https://notarealdomain');
});
Expand Down

0 comments on commit 831e61d

Please sign in to comment.