[feat] add case insensitive search for users (#3413)

Co-authored-by: Arc <33088785+arcbtc@users.noreply.github.com>
This commit is contained in:
Vlad Stan
2025-10-16 23:23:01 +01:00
committed by GitHub
co-authored by Arc
parent 4cf9fae3e3
commit 40c065708a
2 changed files with 20 additions and 2 deletions
+12
View File
@@ -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