From 7e1277e2d154df3fc4da88efb0f10faf05897f6b Mon Sep 17 00:00:00 2001 From: Karchnu Date: Thu, 25 Jun 2020 16:44:35 +0200 Subject: [PATCH] Search users on login and full name (in their profile). --- src/main.cr | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.cr b/src/main.cr index 4d844da..ca8b4ab 100644 --- a/src/main.cr +++ b/src/main.cr @@ -406,7 +406,14 @@ class AuthD::Service users = @users.to_a users.each do |u| - if pattern =~ u.login + if pattern =~ u.login || u.profile.try do |profile| + full_name = profile["full_name"]? + if full_name.nil? + false + else + pattern =~ full_name.as_s + end + end puts "#{u.login} matches #{pattern}" matching_users << u.to_public else