mirror of
https://akkoma.dev/AkkomaGang/akkoma-fe.git
synced 2024-11-10 10:39:12 +00:00
Merge branch 'fix/make-user-by-name-case-insensitive' into 'develop'
Make userByName case-insensitive See merge request pleroma/pleroma-fe!489
This commit is contained in:
commit
fcd99ebc5b
2 changed files with 12 additions and 1 deletions
|
@ -91,7 +91,7 @@ export const getters = {
|
||||||
userById: state => id =>
|
userById: state => id =>
|
||||||
state.users.find(user => user.id === id),
|
state.users.find(user => user.id === id),
|
||||||
userByName: state => name =>
|
userByName: state => name =>
|
||||||
state.users.find(user => user.screen_name === name)
|
state.users.find(user => user.screen_name.toLowerCase() === name.toLowerCase())
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultState = {
|
export const defaultState = {
|
||||||
|
|
|
@ -45,6 +45,17 @@ describe('The users module', () => {
|
||||||
const expected = { screen_name: 'Guy', id: '1' }
|
const expected = { screen_name: 'Guy', id: '1' }
|
||||||
expect(getters.userByName(state)(name)).to.eql(expected)
|
expect(getters.userByName(state)(name)).to.eql(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('returns user with matching screen_name with different case', () => {
|
||||||
|
const state = {
|
||||||
|
users: [
|
||||||
|
{ screen_name: 'guy', id: '1' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
const name = 'Guy'
|
||||||
|
const expected = { screen_name: 'guy', id: '1' }
|
||||||
|
expect(getters.userByName(state)(name)).to.eql(expected)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('getUserById', () => {
|
describe('getUserById', () => {
|
||||||
|
|
Loading…
Reference in a new issue