Format
This commit is contained in:
parent
c7943ca177
commit
6dba4a145c
4 changed files with 12 additions and 4 deletions
|
@ -107,7 +107,9 @@ export default define(meta, paramDef, async (ps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps.query) {
|
if (ps.query) {
|
||||||
q.andWhere('emoji.name like :query', { query: `%${sqlLikeEscape(ps.query)}%` });
|
q.andWhere("emoji.name like :query", {
|
||||||
|
query: `%${sqlLikeEscape(ps.query)}%`,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const emojis = await q.orderBy("emoji.id", "DESC").take(ps.limit).getMany();
|
const emojis = await q.orderBy("emoji.id", "DESC").take(ps.limit).getMany();
|
||||||
|
|
|
@ -32,7 +32,9 @@ export const paramDef = {
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps) => {
|
export default define(meta, paramDef, async (ps) => {
|
||||||
const hashtags = await Hashtags.createQueryBuilder("tag")
|
const hashtags = await Hashtags.createQueryBuilder("tag")
|
||||||
.where("tag.name like :q", { q: `${sqlLikeEscape(ps.query.toLowerCase())}%` })
|
.where("tag.name like :q", {
|
||||||
|
q: `${sqlLikeEscape(ps.query.toLowerCase())}%`,
|
||||||
|
})
|
||||||
.orderBy("tag.count", "DESC")
|
.orderBy("tag.count", "DESC")
|
||||||
.groupBy("tag.id")
|
.groupBy("tag.id")
|
||||||
.take(ps.limit)
|
.take(ps.limit)
|
||||||
|
|
|
@ -45,7 +45,9 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||||
if (ps.host) {
|
if (ps.host) {
|
||||||
const q = Users.createQueryBuilder("user")
|
const q = Users.createQueryBuilder("user")
|
||||||
.where("user.isSuspended = FALSE")
|
.where("user.isSuspended = FALSE")
|
||||||
.andWhere("user.host LIKE :host", { host: `${sqlLikeEscape(ps.host.toLowerCase())}%` });
|
.andWhere("user.host LIKE :host", {
|
||||||
|
host: `${sqlLikeEscape(ps.host.toLowerCase())}%`,
|
||||||
|
});
|
||||||
|
|
||||||
if (ps.username) {
|
if (ps.username) {
|
||||||
q.andWhere("user.usernameLower LIKE :username", {
|
q.andWhere("user.usernameLower LIKE :username", {
|
||||||
|
|
|
@ -78,7 +78,9 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||||
const nameQuery = Users.createQueryBuilder("user")
|
const nameQuery = Users.createQueryBuilder("user")
|
||||||
.where(
|
.where(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.where("user.name ILIKE :query", { query: `%${sqlLikeEscape(ps.query)}%` });
|
qb.where("user.name ILIKE :query", {
|
||||||
|
query: `%${sqlLikeEscape(ps.query)}%`,
|
||||||
|
});
|
||||||
|
|
||||||
// Also search username if it qualifies as username
|
// Also search username if it qualifies as username
|
||||||
if (Users.validateLocalUsername(ps.query)) {
|
if (Users.validateLocalUsername(ps.query)) {
|
||||||
|
|
Loading…
Reference in a new issue