[backend/api] Improve remote emoji query

This commit is contained in:
pancakes 2025-03-08 00:28:50 +10:00 committed by Laura Hausmann
parent 805812110a
commit 026cfa0e82
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -59,10 +59,8 @@ public class EmojiController(
{ {
var res = await db.Emojis var res = await db.Emojis
.Where(p => p.Host != null .Where(p => p.Host != null
&& (!string.IsNullOrWhiteSpace(host) && p.Host.ToLower().Contains(host.ToLower()) && (string.IsNullOrWhiteSpace(host) || p.Host.ToLower().Contains(host.ToLower()))
|| string.IsNullOrWhiteSpace(host)) && (string.IsNullOrWhiteSpace(name) || p.Name.ToLower().Contains(name.ToLower())))
&& (!string.IsNullOrWhiteSpace(name) && p.Name.ToLower().Contains(name.ToLower())
|| string.IsNullOrWhiteSpace(name)))
.Select(p => new EmojiResponse .Select(p => new EmojiResponse
{ {
Id = p.Id, Id = p.Id,