From d12ffb92ba2f7dd68a571062e1341fe7a5e16481 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Thu, 22 Jun 2017 17:35:21 +0200 Subject: [PATCH 1/3] Fix description in API search/RSS There were no descriptions in torrents in API/RSS search on dev. The cause was that ES didn't have the field description in it. You should reindex after the merge --- .../roles/elasticsearch/files/elasticsearch_settings.yml | 2 ++ .../ansible/roles/elasticsearch/files/reindex_nyaapantsu.py | 5 +++-- model/torrent.go | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/deploy/ansible/roles/elasticsearch/files/elasticsearch_settings.yml b/deploy/ansible/roles/elasticsearch/files/elasticsearch_settings.yml index 31323efb..9d57e59f 100644 --- a/deploy/ansible/roles/elasticsearch/files/elasticsearch_settings.yml +++ b/deploy/ansible/roles/elasticsearch/files/elasticsearch_settings.yml @@ -52,6 +52,8 @@ mappings: type: keyword category: type: text + description: + type: text sub_category: type: text status: diff --git a/deploy/ansible/roles/elasticsearch/files/reindex_nyaapantsu.py b/deploy/ansible/roles/elasticsearch/files/reindex_nyaapantsu.py index 13b9687b..0b887406 100644 --- a/deploy/ansible/roles/elasticsearch/files/reindex_nyaapantsu.py +++ b/deploy/ansible/roles/elasticsearch/files/reindex_nyaapantsu.py @@ -38,11 +38,11 @@ while fetches: } if action == 'index': select_cur = pgconn.cursor() - select_cur.execute("""SELECT torrent_id, torrent_name, hidden, category, sub_category, status, + select_cur.execute("""SELECT torrent_id, torrent_name, description, hidden, category, sub_category, status, torrent_hash, date, uploader, downloads, filesize, seeders, leechers, completed, language FROM {torrent_tablename} WHERE torrent_id = {torrent_id}""".format(torrent_id=torrent_id, torrent_tablename=torrent_tablename)) - torrent_id, torrent_name, hidden, category, sub_category, status, torrent_hash, date, uploader, downloads, filesize, seeders, leechers, completed, language = select_cur.fetchone() + torrent_id, torrent_name, description, hidden, category, sub_category, status, torrent_hash, date, uploader, downloads, filesize, seeders, leechers, completed, language = select_cur.fetchone() doc = { 'id': torrent_id, 'name': torrent_name.decode('utf-8'), @@ -50,6 +50,7 @@ while fetches: 'sub_category': str(sub_category), 'status': status, 'hidden': hidden, + 'description': description, 'hash': torrent_hash, 'date': date, 'uploader_id': uploader, diff --git a/model/torrent.go b/model/torrent.go index 73a0d0db..e98e56e5 100644 --- a/model/torrent.go +++ b/model/torrent.go @@ -269,8 +269,9 @@ func (t *TorrentJSON) ToTorrent() Torrent { UploaderID: t.UploaderID, Downloads: t.Downloads, //Stardom: t.Stardom, - Filesize: t.Filesize, - //Description: t.Description, + Filesize: t.Filesize, + Description: string(t.Description), + Hidden: t.Hidden, //WebsiteLink: t.WebsiteLink, //Trackers: t.Trackers, //DeletedAt: t.DeletedAt, From 5ab2688e789b74d2585ef812a1ed6124f6c759c5 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Thu, 22 Jun 2017 17:37:09 +0200 Subject: [PATCH 2/3] Forgot to commit this --- deploy/ansible/roles/elasticsearch/files/index_nyaapantsu.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deploy/ansible/roles/elasticsearch/files/index_nyaapantsu.py b/deploy/ansible/roles/elasticsearch/files/index_nyaapantsu.py index 12abdba7..77e0d0fe 100644 --- a/deploy/ansible/roles/elasticsearch/files/index_nyaapantsu.py +++ b/deploy/ansible/roles/elasticsearch/files/index_nyaapantsu.py @@ -21,7 +21,7 @@ es = Elasticsearch() pgconn = psycopg2.connect(dbparams) cur = pgconn.cursor() -cur.execute("""SELECT torrent_id, torrent_name, hidden, category, sub_category, status, +cur.execute("""SELECT torrent_id, torrent_name, description, hidden, category, sub_category, status, torrent_hash, date, uploader, downloads, filesize, seeders, leechers, completed, language FROM {torrent_tablename} WHERE deleted_at IS NULL""".format(torrent_tablename=torrent_tablename)) @@ -29,7 +29,7 @@ cur.execute("""SELECT torrent_id, torrent_name, hidden, category, sub_category, fetches = cur.fetchmany(CHUNK_SIZE) while fetches: actions = list() - for torrent_id, torrent_name, hidden, category, sub_category, status, torrent_hash, date, uploader, downloads, filesize, seeders, leechers, completed, language in fetches: + for torrent_id, torrent_name, description, hidden, category, sub_category, status, torrent_hash, date, uploader, downloads, filesize, seeders, leechers, completed, language in fetches: doc = { 'id': torrent_id, 'name': torrent_name.decode('utf-8'), @@ -38,6 +38,7 @@ while fetches: 'status': status, 'hash': torrent_hash, 'hidden': hidden, + 'description': description, 'date': date, 'uploader_id': uploader, 'downloads': downloads, From 8c62d7bbe639cbc7ded82012a6f2a6b346546ff4 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Fri, 23 Jun 2017 03:15:56 +0200 Subject: [PATCH 3/3] Fix modtools always shown --- public/css/main.css | 5 ----- templates/home.html | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/public/css/main.css b/public/css/main.css index a7c62efe..380aca6c 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -645,7 +645,6 @@ input.filelist-checkbox:checked + table.table-filelist { .tr-cb { width: 20px; text-align: left; - display: none; } .modtools .actions { display: none; @@ -855,10 +854,6 @@ input.filelist-checkbox:checked + table.table-filelist { top:130px; } -#content.content-admin .tr-cb { - display: table-cell; -} - .tr-actions .form-input{ display: inline-block; } diff --git a/templates/home.html b/templates/home.html index f9e12212..85fe952b 100644 --- a/templates/home.html +++ b/templates/home.html @@ -14,7 +14,7 @@ {{ if HasAdmin $.User }} - + {{end}} {{call $.T "category"}} @@ -45,7 +45,7 @@ {{if eq .Status 3}}trusted{{end}} {{if eq .Status 4}}aplus{{end}}" > {{ if HasAdmin $.User }} - + {{ end }}