Improve usability of users view (#5176)
* Improve usability of users view Resolve #5173 * Fix query * Follow review and fix * Follow review
This commit is contained in:
@ -49,6 +49,16 @@ export const meta = {
|
||||
'remote',
|
||||
]),
|
||||
default: 'local'
|
||||
},
|
||||
|
||||
username: {
|
||||
validator: $.optional.str,
|
||||
default: null
|
||||
},
|
||||
|
||||
hostname: {
|
||||
validator: $.optional.str,
|
||||
default: null
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -70,6 +80,14 @@ export default define(meta, async (ps, me) => {
|
||||
case 'remote': query.andWhere('user.host IS NOT NULL'); break;
|
||||
}
|
||||
|
||||
if (ps.username) {
|
||||
query.andWhere('user.usernameLower like :username', { username: ps.username.toLowerCase() + '%' });
|
||||
}
|
||||
|
||||
if (ps.hostname) {
|
||||
query.andWhere('user.host like :hostname', { hostname: '%' + ps.hostname.toLowerCase() + '%' });
|
||||
}
|
||||
|
||||
switch (ps.sort) {
|
||||
case '+follower': query.orderBy('user.followersCount', 'DESC'); break;
|
||||
case '-follower': query.orderBy('user.followersCount', 'ASC'); break;
|
||||
|
Reference in New Issue
Block a user