summary refs log tree commit diff stats
path: root/query.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-21 23:44:03 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-22 00:26:16 -0400
commit37be25ffddafdf5b7ed4c86b25e3e1ad3a6b3362 (patch)
tree63dcbc8d46e1c5089fc339bc2ad07745a9d4e51b /query.go
parent54a4f6f720979dc8c8d6224acd24f04d147ef761 (diff)
downloadgetwtxt-37be25ffddafdf5b7ed4c86b25e3e1ad3a6b3362.tar.gz
tuning query handling
Diffstat (limited to 'query.go')
-rw-r--r--query.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/query.go b/query.go
index c47cfb0..156ccda 100644
--- a/query.go
+++ b/query.go
@@ -55,19 +55,23 @@ func apiEndpointQuery(w http.ResponseWriter, r *http.Request) error {
 	// something went very wrong.
 	switch endpoint {
 	case "users":
-		if urls != "" {
-			out2, err = twtxtCache.QueryUser(urls)
+		if query != "" {
+			out2, err = twtxtCache.QueryUser(query)
 			out = append(out, out2...)
 			apiErrCheck(err, r)
 		}
-		if query != "" {
-			out2, err = twtxtCache.QueryUser(query)
+		if urls != "" {
+			out2, err = twtxtCache.QueryUser(urls)
 			out = append(out, out2...)
 			apiErrCheck(err, r)
 		}
 
 	case "mentions":
-		out, err = twtxtCache.QueryInStatus(query)
+		if urls == "" {
+			return fmt.Errorf("missing URL in mention query")
+		}
+		urls += ">"
+		out, err = twtxtCache.QueryInStatus(urls)
 		apiErrCheck(err, r)
 
 	case "tweets":