Fixed issue with json dashboard index, json file dashboards turned up when filtering on 'is starred'

This commit is contained in:
Torkel Ödegaard
2015-05-25 15:42:59 +02:00
parent 284106b8a8
commit 5f004f95f2
2 changed files with 11 additions and 0 deletions
+4
View File
@@ -47,6 +47,10 @@ func (index *JsonDashIndex) updateLoop() {
func (index *JsonDashIndex) Search(query *Query) ([]*Hit, error) {
results := make([]*Hit, 0)
if query.IsStarred {
return results, nil
}
for _, item := range index.items {
if len(results) > query.Limit {
break
+7
View File
@@ -31,5 +31,12 @@ func TestJsonDashIndex(t *testing.T) {
So(res[0].Title, ShouldEqual, "Home")
})
Convey("Should not return when starred is filtered", func() {
res, err := index.Search(&Query{Title: "", Tag: "", IsStarred: true})
So(err, ShouldBeNil)
So(len(res), ShouldEqual, 0)
})
})
}