mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-06 22:07:55 +00:00
fix(bot): respect member/group name/desc privacy in search
This commit is contained in:
parent
42235cef9c
commit
5f644ab17a
8 changed files with 42 additions and 12 deletions
|
|
@ -24,7 +24,8 @@ public static class DatabaseViewsExt
|
|||
static string Filter(string column) =>
|
||||
$"(position(lower(@filter) in lower(coalesce({column}, ''))) > 0)";
|
||||
|
||||
query.Append($" and ({Filter("name")} or {Filter("display_name")}");
|
||||
var nameColumn = opts.Context == LookupContext.ByOwner ? "name" : "public_name";
|
||||
query.Append($" and ({Filter(nameColumn)} or {Filter("display_name")}");
|
||||
if (opts.SearchDescription)
|
||||
{
|
||||
// We need to account for the possibility of description privacy when searching
|
||||
|
|
@ -60,7 +61,8 @@ public static class DatabaseViewsExt
|
|||
static string Filter(string column) =>
|
||||
$"(position(lower(@filter) in lower(coalesce({column}, ''))) > 0)";
|
||||
|
||||
query.Append($" and ({Filter("name")} or {Filter("display_name")}");
|
||||
var nameColumn = opts.Context == LookupContext.ByOwner ? "name" : "public_name";
|
||||
query.Append($" and ({Filter(nameColumn)} or {Filter("display_name")}");
|
||||
if (opts.SearchDescription)
|
||||
{
|
||||
// We need to account for the possibility of description privacy when searching
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue