Avoid search call for empty query
This commit is contained in:
parent
2ee5c1709d
commit
a23fd4afaf
|
@ -583,9 +583,14 @@ func (svc *service) ServeUserSearchPage(c *model.Client,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
results, err := c.Search(ctx, q, "statuses", 20, true, offset, id)
|
var results *mastodon.Results
|
||||||
if err != nil {
|
if len(q) > 0 {
|
||||||
return
|
results, err = c.Search(ctx, q, "statuses", 20, true, offset, id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
results = &mastodon.Results{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(results.Statuses) == 20 {
|
if len(results.Statuses) == 20 {
|
||||||
|
@ -643,9 +648,14 @@ func (svc *service) ServeSearchPage(c *model.Client,
|
||||||
var nextLink string
|
var nextLink string
|
||||||
var title = "search"
|
var title = "search"
|
||||||
|
|
||||||
results, err := c.Search(ctx, q, qType, 20, true, offset, "")
|
var results *mastodon.Results
|
||||||
if err != nil {
|
if len(q) > 0 {
|
||||||
return
|
results, err = c.Search(ctx, q, qType, 20, true, offset, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
results = &mastodon.Results{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qType == "accounts" && len(results.Accounts) == 20) ||
|
if (qType == "accounts" && len(results.Accounts) == 20) ||
|
||||||
|
|
Loading…
Reference in New Issue