From cd6da05eaac0ee46065c6d1c5fd6fce282594215 Mon Sep 17 00:00:00 2001 From: Ansh Goyal Date: Sun, 23 Jan 2022 10:41:21 +0530 Subject: [PATCH 1/7] Add user ratings on profile page --- critiquebrainz/frontend/messages.pot | 43 ++++++++++--------- .../frontend/templates/user/base.html | 5 +++ .../frontend/templates/user/reviews.html | 7 +++ 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/critiquebrainz/frontend/messages.pot b/critiquebrainz/frontend/messages.pot index 96e5942e5..874c3dc37 100644 --- a/critiquebrainz/frontend/messages.pot +++ b/critiquebrainz/frontend/messages.pot @@ -1,14 +1,14 @@ # Translations template for PROJECT. -# Copyright (C) 2021 ORGANIZATION +# Copyright (C) 2022 ORGANIZATION # This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2021. +# FIRST AUTHOR , 2022. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-08-30 15:52+0000\n" +"POT-Creation-Date: 2022-01-22 18:40+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -211,6 +211,7 @@ msgstr "" #: critiquebrainz/frontend/forms/rate.py:26 #: critiquebrainz/frontend/forms/review.py:43 +#: critiquebrainz/frontend/templates/user/reviews.html:19 msgid "Rating" msgstr "" @@ -270,9 +271,9 @@ msgstr "" #: critiquebrainz/frontend/templates/review/entity/artist.html:15 #: critiquebrainz/frontend/templates/review/modify/artist.html:8 #: critiquebrainz/frontend/templates/review/modify/release_group.html:8 -#: critiquebrainz/frontend/templates/user/reviews.html:36 -#: critiquebrainz/frontend/templates/user/reviews.html:66 -#: critiquebrainz/frontend/templates/user/reviews.html:69 +#: critiquebrainz/frontend/templates/user/reviews.html:37 +#: critiquebrainz/frontend/templates/user/reviews.html:67 +#: critiquebrainz/frontend/templates/user/reviews.html:70 msgid "[Unknown artist]" msgstr "" @@ -530,8 +531,8 @@ msgstr "" #: critiquebrainz/frontend/templates/review/modify/work.html:18 #: critiquebrainz/frontend/templates/search/selector_results.html:29 #: critiquebrainz/frontend/templates/search/selector_results.html:77 -#: critiquebrainz/frontend/templates/user/reviews.html:45 -#: critiquebrainz/frontend/templates/user/reviews.html:59 +#: critiquebrainz/frontend/templates/user/reviews.html:46 +#: critiquebrainz/frontend/templates/user/reviews.html:60 msgid "more" msgstr "" @@ -1163,7 +1164,7 @@ msgstr "" #: critiquebrainz/frontend/templates/review/modify/edit.html:5 #: critiquebrainz/frontend/templates/review/modify/release_group.html:11 #: critiquebrainz/frontend/templates/review/report.html:4 -#: critiquebrainz/frontend/templates/user/reviews.html:32 +#: critiquebrainz/frontend/templates/user/reviews.html:33 msgid "[Unknown release group]" msgstr "" @@ -1439,7 +1440,7 @@ msgid "Modify" msgstr "" #: critiquebrainz/frontend/templates/profile/applications/index.html:36 -#: critiquebrainz/frontend/templates/user/reviews.html:112 +#: critiquebrainz/frontend/templates/user/reviews.html:119 msgid "Delete" msgstr "" @@ -1550,7 +1551,7 @@ msgstr "" #: critiquebrainz/frontend/templates/review/entity/event.html:15 #: critiquebrainz/frontend/templates/review/modify/edit.html:7 #: critiquebrainz/frontend/templates/review/modify/event.html:8 -#: critiquebrainz/frontend/templates/user/reviews.html:39 +#: critiquebrainz/frontend/templates/user/reviews.html:40 msgid "[Unknown event]" msgstr "" @@ -1560,7 +1561,7 @@ msgstr "" #: critiquebrainz/frontend/templates/review/entity/place.html:20 #: critiquebrainz/frontend/templates/review/modify/edit.html:9 #: critiquebrainz/frontend/templates/review/modify/place.html:8 -#: critiquebrainz/frontend/templates/user/reviews.html:50 +#: critiquebrainz/frontend/templates/user/reviews.html:51 msgid "[Unknown place]" msgstr "" @@ -1772,7 +1773,7 @@ msgstr "" #: critiquebrainz/frontend/templates/review/entity/label.html:6 #: critiquebrainz/frontend/templates/review/entity/label.html:15 #: critiquebrainz/frontend/templates/review/modify/label.html:8 -#: critiquebrainz/frontend/templates/user/reviews.html:75 +#: critiquebrainz/frontend/templates/user/reviews.html:76 msgid "[Unknown label]" msgstr "" @@ -1799,7 +1800,7 @@ msgstr "" #: critiquebrainz/frontend/templates/review/entity/recording.html:6 #: critiquebrainz/frontend/templates/review/entity/recording.html:15 #: critiquebrainz/frontend/templates/review/modify/recording.html:8 -#: critiquebrainz/frontend/templates/user/reviews.html:65 +#: critiquebrainz/frontend/templates/user/reviews.html:66 msgid "[Unknown recording]" msgstr "" @@ -1811,7 +1812,7 @@ msgstr "" #: critiquebrainz/frontend/templates/review/entity/work.html:6 #: critiquebrainz/frontend/templates/review/entity/work.html:15 #: critiquebrainz/frontend/templates/review/modify/work.html:8 -#: critiquebrainz/frontend/templates/user/reviews.html:53 +#: critiquebrainz/frontend/templates/user/reviews.html:54 msgid "[Unknown work]" msgstr "" @@ -1874,12 +1875,12 @@ msgid "Status" msgstr "" #: critiquebrainz/frontend/templates/review/modify/edit.html:28 -#: critiquebrainz/frontend/templates/user/reviews.html:90 +#: critiquebrainz/frontend/templates/user/reviews.html:91 msgid "Draft" msgstr "" #: critiquebrainz/frontend/templates/review/modify/edit.html:30 -#: critiquebrainz/frontend/templates/user/reviews.html:92 +#: critiquebrainz/frontend/templates/user/reviews.html:93 msgid "Published" msgstr "" @@ -2116,19 +2117,19 @@ msgstr "" msgid "This month" msgstr "" -#: critiquebrainz/frontend/templates/user/reviews.html:98 +#: critiquebrainz/frontend/templates/user/reviews.html:99 msgid "Hidden" msgstr "" -#: critiquebrainz/frontend/templates/user/reviews.html:111 +#: critiquebrainz/frontend/templates/user/reviews.html:118 msgid "Edit" msgstr "" -#: critiquebrainz/frontend/templates/user/reviews.html:123 +#: critiquebrainz/frontend/templates/user/reviews.html:130 msgid "Newer" msgstr "" -#: critiquebrainz/frontend/templates/user/reviews.html:126 +#: critiquebrainz/frontend/templates/user/reviews.html:133 msgid "Older" msgstr "" diff --git a/critiquebrainz/frontend/templates/user/base.html b/critiquebrainz/frontend/templates/user/base.html index dede0afc0..d275b5806 100644 --- a/critiquebrainz/frontend/templates/user/base.html +++ b/critiquebrainz/frontend/templates/user/base.html @@ -30,3 +30,8 @@

{{ use {% block profile_content %}{% endblock %} {% endblock %} + +{% block scripts %} + {{ super() }} + +{% endblock %} diff --git a/critiquebrainz/frontend/templates/user/reviews.html b/critiquebrainz/frontend/templates/user/reviews.html index e6dbdc6ab..4de887489 100644 --- a/critiquebrainz/frontend/templates/user/reviews.html +++ b/critiquebrainz/frontend/templates/user/reviews.html @@ -16,6 +16,7 @@ {{ _('Created on') }} {{ _('Published on')}} {{ _('Votes (+/-)') }} + {{ _('Rating') }} {% if current_user.is_authenticated and current_user == user %} {% endif %} @@ -106,6 +107,12 @@ {{ review.published_on | date }} {% endif %} {{ review.votes_positive_count }}/{{ review.votes_negative_count }} + {% if review.rating %} + + {% else %} + + {% endif %} + {% if current_user.is_authenticated and current_user == user %} {{ _('Edit') }} From 76dccd16c2a011159f03add1220e9d256a7c8c07 Mon Sep 17 00:00:00 2001 From: akshaaatt Date: Sun, 23 Jan 2022 20:51:56 +0530 Subject: [PATCH 2/7] Temporary fix for certificate verification --- docker/Dockerfile.dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index 959973795..7a3b4305b 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -18,7 +18,7 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* # PostgreSQL client -RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - +RUN curl --insecure https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - ENV PG_MAJOR 12 RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list RUN apt-get update \ From 0778498c8434944ae6d9388e07c98e8e9e1e6747 Mon Sep 17 00:00:00 2001 From: akshaaatt Date: Sun, 23 Jan 2022 21:12:19 +0530 Subject: [PATCH 3/7] Permanent fix for certificate verification --- Dockerfile | 7 +++++++ docker/Dockerfile.dev | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9fd9dceb8..c8c8dff86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,12 @@ FROM metabrainz/python:3.8-20210115 +# remove expired let's encrypt certificate and install new ones +RUN apt-get update \ + && apt-get install -y --no-install-recommends ca-certificates \ + && rm -rf /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt \ + && update-ca-certificates \ + && rm -rf /var/lib/apt/lists/* + RUN apt-get update \ && apt-get install -y --no-install-recommends \ build-essential \ diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index 7a3b4305b..4e90c1886 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -1,5 +1,12 @@ FROM metabrainz/python:3.8-20210115 +# remove expired let's encrypt certificate and install new ones +RUN apt-get update \ + && apt-get install -y --no-install-recommends ca-certificates \ + && rm -rf /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt \ + && update-ca-certificates \ + && rm -rf /var/lib/apt/lists/* + ENV DOCKERIZE_VERSION v0.6.1 RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz @@ -18,7 +25,7 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* # PostgreSQL client -RUN curl --insecure https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - +RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - ENV PG_MAJOR 12 RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list RUN apt-get update \ From b0e0d91237b46f3006aa2ea553c8d6441123486c Mon Sep 17 00:00:00 2001 From: Ansh Goyal Date: Fri, 28 Jan 2022 00:28:55 +0530 Subject: [PATCH 4/7] Changed Script tag location --- critiquebrainz/frontend/templates/user/base.html | 5 ----- critiquebrainz/frontend/templates/user/reviews.html | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/critiquebrainz/frontend/templates/user/base.html b/critiquebrainz/frontend/templates/user/base.html index d275b5806..dede0afc0 100644 --- a/critiquebrainz/frontend/templates/user/base.html +++ b/critiquebrainz/frontend/templates/user/base.html @@ -30,8 +30,3 @@

{{ use {% block profile_content %}{% endblock %} {% endblock %} - -{% block scripts %} - {{ super() }} - -{% endblock %} diff --git a/critiquebrainz/frontend/templates/user/reviews.html b/critiquebrainz/frontend/templates/user/reviews.html index 4de887489..3d1fe61a3 100644 --- a/critiquebrainz/frontend/templates/user/reviews.html +++ b/critiquebrainz/frontend/templates/user/reviews.html @@ -136,3 +136,8 @@ {% endif %} {% endif %} {% endblock %} + +{% block scripts %} + {{ super() }} + +{% endblock %} From 51e1886d2085edb38bf9e6dea6e449e13f4f4b8e Mon Sep 17 00:00:00 2001 From: Ansh Goyal Date: Sat, 29 Jan 2022 12:15:23 +0530 Subject: [PATCH 5/7] Add pagination to macros --- critiquebrainz/frontend/messages.pot | 57 ++++++++----------- .../frontend/templates/artist/entity.html | 13 +---- critiquebrainz/frontend/templates/macros.html | 39 ++++++++++++- .../frontend/templates/mapping/spotify.html | 15 +---- .../frontend/templates/review/browse.html | 13 +---- .../frontend/templates/user/reviews.html | 11 +--- .../frontend/templates/work/entity.html | 13 +---- 7 files changed, 71 insertions(+), 90 deletions(-) diff --git a/critiquebrainz/frontend/messages.pot b/critiquebrainz/frontend/messages.pot index 874c3dc37..7e19c31c9 100644 --- a/critiquebrainz/frontend/messages.pot +++ b/critiquebrainz/frontend/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-01-22 18:40+0000\n" +"POT-Creation-Date: 2022-01-29 06:35+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -536,6 +536,14 @@ msgstr "" msgid "more" msgstr "" +#: critiquebrainz/frontend/templates/macros.html:229 +msgid "Previous" +msgstr "" + +#: critiquebrainz/frontend/templates/macros.html:255 +msgid "Next" +msgstr "" + #: critiquebrainz/frontend/templates/navbar.html:6 msgid "Toggle navigation" msgstr "" @@ -691,57 +699,45 @@ msgid_plural "%(num)d reviews" msgstr[0] "" msgstr[1] "" -#: critiquebrainz/frontend/templates/artist/entity.html:154 -#: critiquebrainz/frontend/templates/review/browse.html:57 -#: critiquebrainz/frontend/templates/work/entity.html:105 -msgid "Previous" -msgstr "" - -#: critiquebrainz/frontend/templates/artist/entity.html:157 -#: critiquebrainz/frontend/templates/review/browse.html:60 -#: critiquebrainz/frontend/templates/work/entity.html:108 -msgid "Next" -msgstr "" - -#: critiquebrainz/frontend/templates/artist/entity.html:168 +#: critiquebrainz/frontend/templates/artist/entity.html:159 msgid "Artist information" msgstr "" -#: critiquebrainz/frontend/templates/artist/entity.html:174 +#: critiquebrainz/frontend/templates/artist/entity.html:165 msgid "Member of" msgstr "" -#: critiquebrainz/frontend/templates/artist/entity.html:176 +#: critiquebrainz/frontend/templates/artist/entity.html:167 msgid "Members" msgstr "" -#: critiquebrainz/frontend/templates/artist/entity.html:185 -#: critiquebrainz/frontend/templates/artist/entity.html:205 +#: critiquebrainz/frontend/templates/artist/entity.html:176 +#: critiquebrainz/frontend/templates/artist/entity.html:196 msgid "View all..." msgstr "" -#: critiquebrainz/frontend/templates/artist/entity.html:193 +#: critiquebrainz/frontend/templates/artist/entity.html:184 msgid "Former member of" msgstr "" -#: critiquebrainz/frontend/templates/artist/entity.html:195 +#: critiquebrainz/frontend/templates/artist/entity.html:186 msgid "Former members" msgstr "" -#: critiquebrainz/frontend/templates/artist/entity.html:212 +#: critiquebrainz/frontend/templates/artist/entity.html:203 #: critiquebrainz/frontend/templates/label/entity.html:75 #: critiquebrainz/frontend/templates/place/entity.html:105 #: critiquebrainz/frontend/templates/recording/entity.html:95 -#: critiquebrainz/frontend/templates/work/entity.html:121 +#: critiquebrainz/frontend/templates/work/entity.html:112 msgid "External links" msgstr "" -#: critiquebrainz/frontend/templates/artist/entity.html:232 +#: critiquebrainz/frontend/templates/artist/entity.html:223 #: critiquebrainz/frontend/templates/event/entity.html:142 #: critiquebrainz/frontend/templates/label/entity.html:95 #: critiquebrainz/frontend/templates/place/entity.html:135 #: critiquebrainz/frontend/templates/recording/entity.html:115 -#: critiquebrainz/frontend/templates/work/entity.html:141 +#: critiquebrainz/frontend/templates/work/entity.html:132 msgid "Edit on MusicBrainz" msgstr "" @@ -2125,14 +2121,6 @@ msgstr "" msgid "Edit" msgstr "" -#: critiquebrainz/frontend/templates/user/reviews.html:130 -msgid "Newer" -msgstr "" - -#: critiquebrainz/frontend/templates/user/reviews.html:133 -msgid "Older" -msgstr "" - #: critiquebrainz/frontend/templates/work/entity.html:68 msgid "Recordings" msgstr "" @@ -2141,7 +2129,7 @@ msgstr "" msgid "No recordings found" msgstr "" -#: critiquebrainz/frontend/templates/work/entity.html:118 +#: critiquebrainz/frontend/templates/work/entity.html:109 msgid "Work information" msgstr "" @@ -2202,7 +2190,8 @@ msgstr "" msgid "No logs to display." msgstr "" -#: critiquebrainz/frontend/views/login.py:34 +#: critiquebrainz/frontend/views/login.py:36 +#: critiquebrainz/frontend/views/login.py:38 msgid "Login failed." msgstr "" diff --git a/critiquebrainz/frontend/templates/artist/entity.html b/critiquebrainz/frontend/templates/artist/entity.html index 3e988b251..4aecc4620 100644 --- a/critiquebrainz/frontend/templates/artist/entity.html +++ b/critiquebrainz/frontend/templates/artist/entity.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% from 'macros.html' import cover_art, entity_rate_form, show_avg_rating with context %} +{% from 'macros.html' import cover_art, entity_rate_form, show_avg_rating, display_pagination with context %} {% from 'common.html' import rating_script with context %} {% block title %}{{ artist.name }} - CritiqueBrainz{% endblock %} @@ -148,16 +148,7 @@

{{ _('Discography') }}

{% if release_group_count > release_groups_limit %} -
- -
+ {{ display_pagination(page, (release_group_count/release_groups_limit)|round(method='ceil')|int, 'artist.entity', {'id': id, 'release_type':release_type}) }} {% endif %} {% endif %} diff --git a/critiquebrainz/frontend/templates/macros.html b/critiquebrainz/frontend/templates/macros.html index 522e19aed..6c634fbf9 100644 --- a/critiquebrainz/frontend/templates/macros.html +++ b/critiquebrainz/frontend/templates/macros.html @@ -94,7 +94,7 @@