From 6a0a8e8ab4a1c771554646cc91af966379b28bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DURR?= Date: Thu, 8 Dec 2022 18:26:41 +0100 Subject: [PATCH 01/12] Edited bar manager club to pdf (pdfesti) (#503) * Edited bar manager club to pdf (pdfesti) * Fixed unit tests --- club/tests.py | 6 ++++-- sith/settings.py | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/club/tests.py b/club/tests.py index 63b48f47..b7f3226f 100644 --- a/club/tests.py +++ b/club/tests.py @@ -33,6 +33,8 @@ from django.core.exceptions import ValidationError, NON_FIELD_ERRORS from core.models import User from club.models import Club, Membership, Mailing from club.forms import MailingForm +from sith.settings import SITH_BAR_MANAGER + # Create your tests here. @@ -43,7 +45,7 @@ class ClubTest(TestCase): self.skia = User.objects.filter(username="skia").first() self.rbatsbak = User.objects.filter(username="rbatsbak").first() self.guy = User.objects.filter(username="guy").first() - self.bdf = Club.objects.filter(unix_name="bdf").first() + self.bdf = Club.objects.filter(unix_name=SITH_BAR_MANAGER["unix_name"]).first() def test_create_add_user_to_club_from_root_ok(self): self.client.login(username="root", password="plop") @@ -390,7 +392,7 @@ class MailingFormTest(TestCase): self.rbatsbak = User.objects.filter(username="rbatsbak").first() self.krophil = User.objects.filter(username="krophil").first() self.comunity = User.objects.filter(username="comunity").first() - self.bdf = Club.objects.filter(unix_name="bdf").first() + self.bdf = Club.objects.filter(unix_name=SITH_BAR_MANAGER["unix_name"]).first() Membership( user=self.rbatsbak, club=self.bdf, diff --git a/sith/settings.py b/sith/settings.py index 3f15ad35..1a2ed664 100644 --- a/sith/settings.py +++ b/sith/settings.py @@ -278,8 +278,8 @@ SITH_MAIN_CLUB = { # Bar managers SITH_BAR_MANAGER = { - "name": "BdF", - "unix_name": "bdf", + "name": "Pdf", + "unix_name": "pdfesti", "address": "6 Boulevard Anatole France, 90000 Belfort", } @@ -376,7 +376,7 @@ SITH_SUBSCRIPTION_LOCATIONS = [ SITH_COUNTER_BARS = [(1, "MDE"), (2, "Foyer"), (35, "La Gommette")] -SITH_COUNTER_OFFICES = {2: "BdF", 1: "AE"} +SITH_COUNTER_OFFICES = {2: "PdF", 1: "AE"} SITH_COUNTER_PAYMENT_METHOD = [ ("CHECK", _("Check")), From 8fb089716020dab76c50398fe589959625ac1754 Mon Sep 17 00:00:00 2001 From: thomas girod <56346771+imperosol@users.noreply.github.com> Date: Sun, 11 Dec 2022 10:56:02 +0100 Subject: [PATCH 02/12] add a sentry capture for when eboutic basket regex validation fails. (#504) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Théo DURR --- .gitignore | 1 + eboutic/forms.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 511f5fbf..c6c093e6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ db.sqlite3 pyrightconfig.json dist/ .vscode/ +.idea/ env/ doc/html data/ diff --git a/eboutic/forms.py b/eboutic/forms.py index 8f1ddaf1..b93ee549 100644 --- a/eboutic/forms.py +++ b/eboutic/forms.py @@ -28,6 +28,7 @@ import typing from django.http import HttpRequest from django.utils.translation import gettext as _ +from sentry_sdk import capture_message from eboutic.models import get_eboutic_products @@ -104,6 +105,13 @@ class BasketForm: # check that the json is not nested before parsing it to make sure # malicious user can't ddos the server with deeply nested json if not BasketForm.json_cookie_re.match(basket): + # As the validation of the cookie goes through a rather boring regex, + # we can regularly have to deal with subtle errors that we hadn't forecasted, + # so we explicitly lay a Sentry message capture here. + capture_message( + "Eboutic basket regex checking failed to validate basket json", + level="error", + ) self.error_messages.add(_("The request was badly formatted.")) return try: From 3e5c36b39ef3bd049ca5bdd1f06206fc7d8d0c25 Mon Sep 17 00:00:00 2001 From: Julien Constant <49886317+Juknum@users.noreply.github.com> Date: Mon, 12 Dec 2022 20:27:47 +0100 Subject: [PATCH 03/12] Fix election candidate overflowing texte (#506) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le texte affiché lorsqu'on appuyait sur "Show more" dépassait horizontalement (programme des candidats) --- core/static/election/election.scss | 15 ++++++++++++--- election/templates/election/election_detail.jinja | 6 +++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/core/static/election/election.scss b/core/static/election/election.scss index 0af2286d..b51fe0d3 100644 --- a/core/static/election/election.scss +++ b/core/static/election/election.scss @@ -166,14 +166,15 @@ $min_col_width: 100px; flex-direction: row; flex-wrap: wrap; justify-content: center; + width: 100%; gap: $gap; >.candidate { display: flex; flex-direction: column; align-items: center; - list-style-type: none; + width: 100%; gap: $gap; >input[type="radio"]:checked + label, @@ -186,6 +187,10 @@ $min_col_width: 100px; } } + >label { + width: 100%; + } + >label>figure, >figure { position: relative; @@ -196,15 +201,19 @@ $min_col_width: 100px; padding: 10px; >img { - max-width: 100%; + max-width: 100% !important; } >figcaption { + width: 100%; + max-width: inherit !important; + overflow: hidden; + h5 { margin: 0; text-align: center; } - q { + .candidate_program { margin: 5px 0; } } diff --git a/election/templates/election/election_detail.jinja b/election/templates/election/election_detail.jinja index 853fab78..51eeb704 100644 --- a/election/templates/election/election_detail.jinja +++ b/election/templates/election/election_detail.jinja @@ -100,7 +100,7 @@ - + {%- if role.max_choice == 1 and election.can_vote(user) %}
@@ -118,7 +118,7 @@ {%- endif %} {%- for election_list in election_lists %} - +