From 406c5c879b82e9c2d03e2b29c7a76fc2fec7b4c3 Mon Sep 17 00:00:00 2001 From: kilo Date: Sun, 3 Sep 2017 01:49:53 +0200 Subject: [PATCH 1/2] Fix css that didn't apply & slightly better margin (#1464) * Remove too big margin * add bottom margin for tags * Update main.css --- public/css/main.css | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/public/css/main.css b/public/css/main.css index c3e71472e..530cfc418 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -1796,17 +1796,21 @@ span.tag-text { padding: 0 3px; display: inline-block; } -.accepted span.tag-text { - margin-right: 3px; -} span.tag { border-radius: 1rem; box-shadow: 0px 0px 1px 0px #636363; + margin-bottom: 1px; +} +.tag.accepted { + margin-right: 2px; } .tag.accepted a{ - margin-right: 1px; + margin-right: 3px; +} +.tag.accepted span a { + margin-right: 0; } .tag.accepted i{ padding: 0px 0px 3px 0px; From 38d3e45ef47b53f138a4be7495fc3ea83099cbc1 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Sun, 3 Sep 2017 02:11:19 +0200 Subject: [PATCH 2/2] Fix search Status (#1467) Should fix #1428 ?s=2 and others. Reason: the sql query wasn't correct when filtering (status >= ? = ?) --- utils/search/status.go | 8 ++++---- utils/search/status_test.go | 16 ++++++++++++---- utils/search/torrentParam.go | 4 ++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/utils/search/status.go b/utils/search/status.go index 2cb9f244a..2e0cee5eb 100644 --- a/utils/search/status.go +++ b/utils/search/status.go @@ -63,16 +63,16 @@ func (st *Status) ToESQuery() string { } // ToDBQuery prepare a DB statement for status -func (st *Status) ToDBQuery() string { +func (st *Status) ToDBQuery() (string, string) { if *st != ShowAll { if *st != FilterRemakes { // Only show torrents with status over the one specified - return "status >= " + st.String() + return "status >= ?", st.String() } /* From the old nyaa behavior, FilterRemake means everything BUT * remakes */ - return "status <> " + st.String() + return "status <> ?", st.String() } - return "" + return "", "" } diff --git a/utils/search/status_test.go b/utils/search/status_test.go index 60cc6c9e6..18b7e4f2e 100644 --- a/utils/search/status_test.go +++ b/utils/search/status_test.go @@ -45,11 +45,19 @@ func TestStatus_ToESQuery(t *testing.T) { func TestStatus_ToDBQuery(t *testing.T) { assert := assert.New(t) status := Status(0) - assert.Empty(status.ToDBQuery(), "Should be empty") + sql, st := status.ToDBQuery() + assert.Empty(sql, "Should be empty") + assert.Empty(st, "Should be empty") status = Status(3) - assert.Equal("status >= 3", status.ToDBQuery(), "Should be equal") + sql, st = status.ToDBQuery() + assert.Equal("status >= ?", sql, "Should be equal") + assert.Equal("3", st, "Should be equal") status = Status(1) - assert.Equal("status >= 1", status.ToDBQuery(), "Should be equal") + sql, st = status.ToDBQuery() + assert.Equal("status >= ?", sql, "Should be equal") + assert.Equal("1", st, "Should be equal") status = Status(2) - assert.Equal("status <> 2", status.ToDBQuery(), "Should be equal") + sql, st = status.ToDBQuery() + assert.Equal("status <> ?", sql, "Should be equal") + assert.Equal("2", st, "Should be equal") } diff --git a/utils/search/torrentParam.go b/utils/search/torrentParam.go index 839e4da9f..37e93cb86 100644 --- a/utils/search/torrentParam.go +++ b/utils/search/torrentParam.go @@ -344,7 +344,7 @@ func (p *TorrentParam) toDBQuery(c *gin.Context) *Query { sql, cats := p.Category.ToDBQuery() query.Append(sql, cats...) - + if len(p.Languages) > 0 { query.Append("language "+searchOperator, "%"+langsToDBQuery(p.Languages)+"%") } @@ -401,7 +401,7 @@ func (p *TorrentParam) toDBQuery(c *gin.Context) *Query { query.Append("date <= ?", p.ToDate.ToDBQuery()) } if p.Status != 0 { - query.Append(p.Status.ToDBQuery(), strconv.Itoa(int(p.Status)+1)) + query.Append(p.Status.ToDBQuery()) } if len(p.NotNull) > 0 { query.Append(p.NotNull)