-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix supporter being required when selecting default options in beatmap listing #11419
Merged
nanaya
merged 7 commits into
ppy:master
from
notbakaneko:feature/beatmapset-search-filter-default-reset
Aug 13, 2024
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
33436d2
null if default
notbakaneko 95a89f6
normalize initial url and filters
notbakaneko f6f5c84
not sure what this worked around, might have been fixed by ppy/osu-we…
notbakaneko 4a40d41
updated currentUser for tests
notbakaneko cf33e84
update user:update test
notbakaneko 7297a1b
reset current user preferences when unsetting user.
notbakaneko 96032c8
Merge branch 'master' into feature/beatmapset-search-filter-default-r…
nanaya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,5 @@ | ||
/** | ||
* Copyright (c) ppy Pty Ltd <[email protected]>. | ||
* | ||
* This file is part of osu!web. osu!web is distributed with the hope of | ||
* attracting more community contributions to the core ecosystem of osu!. | ||
* | ||
* osu!web is free software: you can redistribute it and/or modify | ||
* it under the terms of the Affero GNU General Public License version 3 | ||
* as published by the Free Software Foundation. | ||
* | ||
* osu!web is distributed WITHOUT ANY WARRANTY; without even the implied | ||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with osu!web. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
'use strict'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,30 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
import UserJson from 'interfaces/user-json'; | ||
import User from 'models/user'; | ||
import OsuCore from 'osu-core'; | ||
import testCurrentUserJson from './test-current-user-json'; | ||
|
||
describe('OsuCore user:update subscriber testing thing', () => { | ||
it('user:update should update the user store from a JSON value', () => { | ||
const core = new OsuCore(); | ||
const expectedUser = new User(1); | ||
expectedUser.updateWithJson(testCurrentUserJson); | ||
|
||
const json: UserJson = { | ||
avatar_url: '', | ||
country_code: '', | ||
cover: { custom_url: null, id: null, url: null }, | ||
default_group: '', | ||
id: 1, | ||
is_active: true, | ||
is_bot: false, | ||
is_deleted: false, | ||
is_online: true, | ||
is_supporter: true, | ||
last_visit: null, | ||
pm_friends_only: false, | ||
profile_colour: null, | ||
username: 'foo', | ||
}; | ||
describe('OsuCore user update', () => { | ||
it('.setCurrentUser should update the user store from a JSON value', () => { | ||
const core = new OsuCore(); | ||
core.setCurrentUser(testCurrentUserJson); | ||
|
||
const user = new User(json.id); | ||
user.updateWithJson(json); | ||
expect(core.dataStore.userStore.users.get(1)).toEqual(expectedUser); | ||
expect(core.dataStore.userStore.users.size).toEqual(1); | ||
}); | ||
|
||
$.publish('user:update', json); | ||
it('user:update subscriber should update the user store from a JSON value', () => { | ||
const core = new OsuCore(); | ||
$.publish('user:update', testCurrentUserJson); | ||
|
||
expect(core.dataStore.userStore.users.get(1)).toEqual(user); | ||
expect(core.dataStore.userStore.users.get(1)).toEqual(expectedUser); | ||
expect(core.dataStore.userStore.users.size).toEqual(1); | ||
|
||
// unset the singleton | ||
$.publish('user:update', { id: undefined }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
import CurrentUserJson from 'interfaces/current-user-json'; | ||
import { defaultUserPreferencesJson } from 'interfaces/user-preferences-json'; | ||
|
||
const testCurrentUserJson: CurrentUserJson = { | ||
avatar_url: '', | ||
blocks: [], | ||
country: { | ||
code: 'AU', | ||
name: 'Australia', | ||
}, | ||
country_code: 'AU', | ||
cover: { custom_url: null, id: null, url: null }, | ||
default_group: '', | ||
discord: null, | ||
follow_user_mapping: [], | ||
friends: [], | ||
groups: [], | ||
has_supported: false, | ||
id: 1, | ||
interests: null, | ||
is_active: true, | ||
is_admin: false, | ||
is_bng: false, | ||
is_bot: false, | ||
is_deleted: false, | ||
is_full_bn: false, | ||
is_gmt: false, | ||
is_limited_bn: false, | ||
is_moderator: false, | ||
is_nat: false, | ||
is_online: true, | ||
is_restricted: false, | ||
is_silenced: false, | ||
is_supporter: true, | ||
join_date: '2020-01-01T12:34:56+00:00', | ||
kudosu: { | ||
available: 0, | ||
total: 0, | ||
}, | ||
last_visit: null, | ||
location: null, | ||
max_blocks: 1, | ||
max_friends: 1, | ||
occupation: null, | ||
playmode: 'osu', | ||
playstyle: [], | ||
pm_friends_only: false, | ||
post_count: 0, | ||
profile_colour: null, | ||
profile_hue: null, | ||
profile_order: [], | ||
title: null, | ||
title_url: null, | ||
twitter: null, | ||
unread_pm_count: 0, | ||
user_preferences: defaultUserPreferencesJson, | ||
username: 'foo', | ||
website: null, | ||
}; | ||
|
||
export default testCurrentUserJson; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this for here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actual problem was if tests that simulated having a user ran first and didn't have
user_preferences
set left it undefined when logging out