Pull request: all: fix names of runtime clients on query log page

Updates #2929.

Squashed commit of the following:

commit f02111aac1e9d63732589b65b224613aa3240677
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Apr 7 17:40:16 2021 +0300

    all: fix names of runtime clients on query log page
This commit is contained in:
Ainar Garipov
2021-04-07 17:49:37 +03:00
parent c133b01ef7
commit 908452f883
4 changed files with 2 additions and 14 deletions

View File

@@ -287,13 +287,11 @@ func toQueryLogWhois(wi *RuntimeClientWhoisInfo) (cw *querylog.ClientWhois) {
func (clients *clientsContainer) findMultiple(ids []string) (c *querylog.Client, err error) {
for _, id := range ids {
var name string
var foundIDs []string
whois := &querylog.ClientWhois{}
c, ok := clients.Find(id)
if ok {
name = c.Name
foundIDs = c.IDs
} else {
var rc RuntimeClient
rc, ok = clients.FindRuntimeClient(id)
@@ -301,7 +299,7 @@ func (clients *clientsContainer) findMultiple(ids []string) (c *querylog.Client,
continue
}
foundIDs = []string{rc.Host}
name = rc.Host
whois = toQueryLogWhois(rc.WhoisInfo)
}
@@ -312,7 +310,6 @@ func (clients *clientsContainer) findMultiple(ids []string) (c *querylog.Client,
Name: name,
DisallowedRule: disallowedRule,
Whois: whois,
IDs: foundIDs,
Disallowed: disallowed,
}, nil
}