From 99808a929be067230d4badf489f10b63b22f3205 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 23:42:26 +0000 Subject: [PATCH 01/44] chore(deps): bump path-parse from 1.0.6 to 1.0.7 Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 2f94d917b..aff2fe86b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3098,9 +3098,9 @@ path-key@^2.0.0, path-key@^2.0.1: integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= path-parse@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" - integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-platform@~0.11.15: version "0.11.15" From 66cb28a054088a0c4fbac99a6955cd59c1e079db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Jan 2022 19:11:18 +0000 Subject: [PATCH 02/44] chore(deps): bump ipython from 7.12.0 to 7.16.3 in /requirements Bumps [ipython](https://github.com/ipython/ipython) from 7.12.0 to 7.16.3. - [Release notes](https://github.com/ipython/ipython/releases) - [Commits](https://github.com/ipython/ipython/compare/7.12.0...7.16.3) --- updated-dependencies: - dependency-name: ipython dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index e0167b507..539b6b0d9 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -67,7 +67,7 @@ certifi>=2019.11.28 # Better python shell. # http://ipython.org/ -ipython==7.12.0 +ipython==7.16.3 # The most feature-rich and easy-to-use library for processing XML and HTML in # the Python language. From 687fcdcdda071d02d6edc88d42fa510217d78b21 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Wed, 8 Mar 2023 15:11:03 +0800 Subject: [PATCH 03/44] chore(ci): install from dev requirements --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b52b207b2..49f4bae75 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -38,7 +38,7 @@ jobs: - name: Set up Python dependencies run: | pip install -U pip - pip install -r requirements/ci.txt + pip install -r requirements/dev.txt - uses: actions/setup-node@v3 with: From baa45ba81e35ea1f3fd5ac924290ce9133d396d6 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Thu, 9 Mar 2023 13:55:04 +0800 Subject: [PATCH 04/44] chore: delete ci requirements --- requirements/ci.txt | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 requirements/ci.txt diff --git a/requirements/ci.txt b/requirements/ci.txt deleted file mode 100644 index 02327311c..000000000 --- a/requirements/ci.txt +++ /dev/null @@ -1,2 +0,0 @@ --r dev.txt -pycrypto From 7e27dcb526f850d6b26a28dbb796de718c123e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cianhsieh2028=E2=80=9D?= <“ian.yshsieh@gmail.com”> Date: Thu, 29 Jun 2023 00:55:34 +0800 Subject: [PATCH 05/44] Adjust color setting of review edit view --- src/static/css/pages/_proposals.scss | 4 ++-- src/static/pycontw-2023/_includes/_bootstrap-variables.scss | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/static/css/pages/_proposals.scss b/src/static/css/pages/_proposals.scss index 053fec4ac..5e55a5a7e 100644 --- a/src/static/css/pages/_proposals.scss +++ b/src/static/css/pages/_proposals.scss @@ -122,7 +122,7 @@ body.dashboard{ display: inline-block; text-decoration: none; padding: 0 0.5em; - color: $text-color; + color: $diff-text-color; } del { background-color: lighten($brand-danger, 33.5%); @@ -146,7 +146,7 @@ body.dashboard{ } ins > ins { padding: 0; - background-color: lighten($brand-success, 20%); + background-color: $diff-text-bg-color; } } .markdown-field { diff --git a/src/static/pycontw-2023/_includes/_bootstrap-variables.scss b/src/static/pycontw-2023/_includes/_bootstrap-variables.scss index 16d63a472..d294383f4 100644 --- a/src/static/pycontw-2023/_includes/_bootstrap-variables.scss +++ b/src/static/pycontw-2023/_includes/_bootstrap-variables.scss @@ -32,6 +32,10 @@ $brand-primary: #e8a4e9 !default; // //** Global text color on ``. $text-color: #f0ebf5 !default; +// //** Color setting for review edit view. +$diff-text-color: #3c0970 !default; +$diff-text-bg-color: #eba292 !default; + // //** Global textual link color. // $link-color: $brand-primary !default; // //** Link hover color set via `darken()` function. From 6da114e7351b7ce531f5aaa74c260efc25b8942d Mon Sep 17 00:00:00 2001 From: Winnie Date: Mon, 10 Jul 2023 18:13:09 +0800 Subject: [PATCH 06/44] test(attendee): add test cases for attendee apis --- src/attendee/tests.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/attendee/tests.py b/src/attendee/tests.py index e69de29bb..d1b61ea26 100644 --- a/src/attendee/tests.py +++ b/src/attendee/tests.py @@ -0,0 +1,31 @@ +import pytest +from django.conf import settings +from registry.helper import reg +from attendee.models import Attendee +from core.models import Token + + +@pytest.mark.parametrize('attendee_token,status,num_channel', [ + ('123', 400, 0), + ('1234', 200, 0), + ('1234', 200, 1), + ('1234', 200, 2), +]) +@pytest.mark.django_db +def test_attendee(drf_api_client, bare_user, attendee_token, status, num_channel): + token = Token.objects.get_or_create(user=bare_user) + drf_api_client.credentials(HTTP_AUTHORIZATION="Token " + str(token[0])) + attendee = Attendee(token="1234") + attendee.save() # insert to database + # add slug + key_prefix = f"{settings.CONFERENCE_DEFAULT_SLUG}.live." + reg["pycontw-1999.live.r1"] = "video_old_id" # unrelated + for i in range(num_channel): + reg[f"{key_prefix}r{i}"] = f"video_id_{i}" + print(f"{key_prefix}r{i}") + + # test + response = drf_api_client.post('/api/attendee/verify/', data={"token": attendee_token}) + assert response.status_code == status + if status == 200: + assert len(response.json()["youtube_infos"]) == num_channel From 74b334a5f1124365b22d81fd98605c37bad42d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cianhsieh2028=E2=80=9D?= <“ian.yshsieh@gmail.com”> Date: Wed, 12 Jul 2023 21:14:34 +0800 Subject: [PATCH 07/44] Drop the use of scss variables and use real values instead --- src/static/css/pages/_proposals.scss | 4 ++-- src/static/pycontw-2023/_includes/_bootstrap-variables.scss | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/static/css/pages/_proposals.scss b/src/static/css/pages/_proposals.scss index 5e55a5a7e..d86d3e015 100644 --- a/src/static/css/pages/_proposals.scss +++ b/src/static/css/pages/_proposals.scss @@ -122,7 +122,7 @@ body.dashboard{ display: inline-block; text-decoration: none; padding: 0 0.5em; - color: $diff-text-color; + color: #3c0970; } del { background-color: lighten($brand-danger, 33.5%); @@ -146,7 +146,7 @@ body.dashboard{ } ins > ins { padding: 0; - background-color: $diff-text-bg-color; + background-color: #eba292; } } .markdown-field { diff --git a/src/static/pycontw-2023/_includes/_bootstrap-variables.scss b/src/static/pycontw-2023/_includes/_bootstrap-variables.scss index d294383f4..16d63a472 100644 --- a/src/static/pycontw-2023/_includes/_bootstrap-variables.scss +++ b/src/static/pycontw-2023/_includes/_bootstrap-variables.scss @@ -32,10 +32,6 @@ $brand-primary: #e8a4e9 !default; // //** Global text color on ``. $text-color: #f0ebf5 !default; -// //** Color setting for review edit view. -$diff-text-color: #3c0970 !default; -$diff-text-bg-color: #eba292 !default; - // //** Global textual link color. // $link-color: $brand-primary !default; // //** Link hover color set via `darken()` function. From 7fff5818e7492bbf40a221abfe3f80528dac930b Mon Sep 17 00:00:00 2001 From: Winnie Date: Wed, 12 Jul 2023 22:22:24 +0800 Subject: [PATCH 08/44] fix linter --- src/attendee/tests.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/attendee/tests.py b/src/attendee/tests.py index d1b61ea26..252861424 100644 --- a/src/attendee/tests.py +++ b/src/attendee/tests.py @@ -16,13 +16,12 @@ def test_attendee(drf_api_client, bare_user, attendee_token, status, num_channel token = Token.objects.get_or_create(user=bare_user) drf_api_client.credentials(HTTP_AUTHORIZATION="Token " + str(token[0])) attendee = Attendee(token="1234") - attendee.save() # insert to database + attendee.save() # insert to database # add slug key_prefix = f"{settings.CONFERENCE_DEFAULT_SLUG}.live." reg["pycontw-1999.live.r1"] = "video_old_id" # unrelated for i in range(num_channel): reg[f"{key_prefix}r{i}"] = f"video_id_{i}" - print(f"{key_prefix}r{i}") # test response = drf_api_client.post('/api/attendee/verify/', data={"token": attendee_token}) From 388d71222e97acae7c83745a5a8a4c65f238b7cd Mon Sep 17 00:00:00 2001 From: erik1110 Date: Mon, 24 Jul 2023 00:42:36 +0800 Subject: [PATCH 09/44] [feat] add test cases --- src/ccip/tests/api/test_ccip.py | 17 +++++++++++++++++ src/ccip/tests/conftest.py | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/ccip/tests/api/test_ccip.py create mode 100644 src/ccip/tests/conftest.py diff --git a/src/ccip/tests/api/test_ccip.py b/src/ccip/tests/api/test_ccip.py new file mode 100644 index 000000000..f09d2a1d1 --- /dev/null +++ b/src/ccip/tests/api/test_ccip.py @@ -0,0 +1,17 @@ +import pytest +from django.conf import settings + +endpoint = "/ccip" + +@pytest.mark.django_db +def test_ccip_api_view(client, sample_tags): + + response = client.get(endpoint, follow=True) + assert response.status_code == 200 + + data = response.json() + + assert 'tags' in data + assert isinstance(data['tags'], list) + print("data:", data) + assert data['tags'][0]['en']['name'] == "English talk" diff --git a/src/ccip/tests/conftest.py b/src/ccip/tests/conftest.py new file mode 100644 index 000000000..f2727914e --- /dev/null +++ b/src/ccip/tests/conftest.py @@ -0,0 +1,20 @@ +import pytest +from unittest.mock import Mock +from events.models import ( + CustomEvent, KeynoteEvent, + ProposedTalkEvent, ProposedTutorialEvent, + SponsoredEvent, +) + +@pytest.fixture +def sample_tags(): + tags = [ + { + "id": "lng-ENEN", + "zh": {}, + "en": { + "name": "English talk" + } + }, + ] + return tags \ No newline at end of file From cd93d397c3a2390e21a7f573e900d41adb919089 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Tue, 8 Aug 2023 06:31:16 +0000 Subject: [PATCH 10/44] feat(sponsor): make sponsor en name as a required field --- src/sponsors/translation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sponsors/translation.py b/src/sponsors/translation.py index fcfec5f0c..7db2532c5 100644 --- a/src/sponsors/translation.py +++ b/src/sponsors/translation.py @@ -5,6 +5,7 @@ class SponsorTranslationOptions(TranslationOptions): fields = ('name', 'intro', 'subtitle',) + required_languages = {'default': ('name',)} class OpenRoleTranslationOptions(TranslationOptions): From 5fb88a921800f6048e975c770709d904143e7923 Mon Sep 17 00:00:00 2001 From: Josix Date: Wed, 30 Aug 2023 15:45:25 +0800 Subject: [PATCH 11/44] feat(ccip): let session start/end time follow local timezone --- src/ccip/views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ccip/views.py b/src/ccip/views.py index abfceae1f..5c3c9e655 100644 --- a/src/ccip/views.py +++ b/src/ccip/views.py @@ -1,4 +1,5 @@ import operator +from datetime import timezone, timedelta from django.http import JsonResponse from django.templatetags.static import static @@ -166,11 +167,15 @@ def _transform_session(request, event, type_key, info_getter): for speaker in event_info.speakers ] + LOCAL_TIMEZONE = timezone(offset=timedelta(hours=8)) + # Explicitly show the local timezone used by OPass(CCIP) + # to avoid iOS device showing UTC+0 time without changing it to local time + # https://github.com/CCIP-App/CCIP-iOS/issues/54 session = { 'id': f'{type_key}-{event_info.pk}', 'type': type_key, - 'start': event.begin_time.value.isoformat() if event.begin_time else None, - 'end': event.end_time.value.isoformat() if event.end_time else None, + 'start': event.begin_time.value.astimezone(LOCAL_TIMEZONE).isoformat() if event.begin_time else None, + 'end': event.end_time.value.astimezone(LOCAL_TIMEZONE).isoformat() if event.end_time else None, 'slide': event_info.slide_link, 'speakers': [speaker['id'] for speaker in speakers], 'tags': [tag['id'] for tag in tags], From bad1dec61b237dbc0edce865074b5b01307aa603 Mon Sep 17 00:00:00 2001 From: iknowright Date: Tue, 4 Jul 2023 22:03:19 +0800 Subject: [PATCH 12/44] feat(category-filter): add category filter for proposal review table --- src/reviews/views.py | 27 ++++++++++++++++--- .../reviews/_includes/proposal_table.html | 20 +++++++++++++- .../default/reviews/talk_proposal_list.html | 4 +-- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/reviews/views.py b/src/reviews/views.py index 5eda7064b..9fd08f261 100644 --- a/src/reviews/views.py +++ b/src/reviews/views.py @@ -55,6 +55,10 @@ def get_ordering(self): order_key = self.order_keys.get(params.get('order', '').lower()) return order_key or '?' + def get_category(self): + params = self.request.GET + return params.get('category') + def get_queryset(self): user = self.request.user qs = ( @@ -64,10 +68,7 @@ def get_queryset(self): .exclude(review__reviewer=user) .annotate(Count('review')) ) - # params = self.request.GET - # category = params.get('category', '').upper() - # if category: - # proposals = proposals.filter(category=category) + ordering = self.get_ordering() if ordering == '?': # We don't use order_by('?') because it is crazy slow, and instead @@ -85,8 +86,23 @@ def get_queryset(self): else: qs = qs.order_by(ordering) self.ordering = ordering + self.category = self.get_category() + return qs + def get_category_metrics(self, context): + count = 0 + categories = set() + for proposal in context["object_list"]: + if proposal.category == self.category: + count += 1 + if proposal.category not in categories: + categories.add(proposal.category) + return { + "category_options": categories, + "filtered_count": count if count else len(context["object_list"]) + } + def get_context_data(self, **kwargs): review_stage = self.reviews_state.reviews_stage verdicted_proposals = ( @@ -132,9 +148,12 @@ def get_context_data(self, **kwargs): ), 'vote': vote_mapping, 'ordering': self.ordering, + 'category': self.category, 'query_string': self.request.GET.urlencode(), **self.reviews_state._asdict(), + **self.get_category_metrics(context), }) + print(context) return context def get_stage_1_reviews(self): diff --git a/src/templates/default/reviews/_includes/proposal_table.html b/src/templates/default/reviews/_includes/proposal_table.html index 627a34bd6..49acb05a1 100644 --- a/src/templates/default/reviews/_includes/proposal_table.html +++ b/src/templates/default/reviews/_includes/proposal_table.html @@ -33,6 +33,21 @@ + + + {% if verdict %} {% trans 'Decision' %} {% endif %} @@ -41,6 +56,7 @@ {% for proposal in proposals %} + {% if proposal.category == category or not category %} {% if proposal.accepted == None %} {{ proposal.review__count }} @@ -49,8 +65,9 @@
reviews_enough %} class="grayed-out" {% endif %} >{{ proposal.title }}
{{ proposal.get_language_display }} + {{ proposal.category }} {% if proposal.accepted != None %} - {{ proposal.get_accepted_display }} + {{ proposal.get_accepted_display }} {% endif %} {% if proposal.accepted == None %} @@ -62,6 +79,7 @@ {% endif %} + {% endif %} {% endfor %} diff --git a/src/templates/default/reviews/talk_proposal_list.html b/src/templates/default/reviews/talk_proposal_list.html index 4d65c8393..76741b523 100644 --- a/src/templates/default/reviews/talk_proposal_list.html +++ b/src/templates/default/reviews/talk_proposal_list.html @@ -48,7 +48,7 @@

{% trans 'Personal Review Stats' %}