about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-27 18:08:41 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-27 18:09:15 -0400
commit3c5dd59f5c3be00909df4a509eea940393fd060e (patch)
tree314fcaf75fef2f540861a4acef88fb0a204749a5
parent711012ec003ffe8393f1e41d04eace71cbb5fe4c (diff)
downloadgetwtxt-3c5dd59f5c3be00909df4a509eea940393fd060e.tar.gz
merging user keyword/url queries
-rw-r--r--query.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/query.go b/query.go
index 17d7a36..e74e109 100644
--- a/query.go
+++ b/query.go
@@ -68,15 +68,19 @@ func apiEndpointQuery(w http.ResponseWriter, r *http.Request) error {
 	// something went very wrong.
 	switch endpoint {
 	case "users":
+		var out2 []string
 		if query != "" {
 			out, err = twtxtCache.QueryUser(query)
 			apiErrCheck(err, r)
 		}
 		if urls != "" {
-			out, err = twtxtCache.QueryUser(urls)
+			out2, err = twtxtCache.QueryUser(urls)
 			apiErrCheck(err, r)
 		}
 
+		out = append(out, out2...)
+		out = uniq(out)
+
 	case "mentions":
 		if urls == "" {
 			return fmt.Errorf("missing URL in mention query")