[feat] add case insensitive search for users (#3413)
Co-authored-by: Arc <33088785+arcbtc@users.noreply.github.com>
This commit is contained in:
@@ -335,6 +335,7 @@ window.UsersPageLogic = {
|
||||
},
|
||||
|
||||
fetchUsers(props) {
|
||||
this.relaxFilterForFields(['username', 'email'])
|
||||
const params = LNbits.utils.prepareFilterQuery(this.usersTable, props)
|
||||
LNbits.api
|
||||
.request('GET', `/users/api/v1/user?${params}`)
|
||||
@@ -355,6 +356,17 @@ window.UsersPageLogic = {
|
||||
})
|
||||
.catch(LNbits.utils.notifyApiError)
|
||||
},
|
||||
relaxFilterForFields(fieldNames = []) {
|
||||
fieldNames.forEach(fieldName => {
|
||||
const fieldValue = this.usersTable?.filter?.[fieldName]
|
||||
if (fieldValue) {
|
||||
if (this.usersTable.filter[fieldName]) {
|
||||
this.usersTable.filter[`${fieldName}[like]`] = fieldValue
|
||||
delete this.usersTable.filter[fieldName]
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
toggleAdmin(userId) {
|
||||
LNbits.api
|
||||
|
||||
Reference in New Issue
Block a user