Skip to content

Commit 92cb8a9

Browse files
committed
Merge branch 'development'
2 parents 6e41e7b + e7e537c commit 92cb8a9

File tree

26 files changed

+4262
-2362
lines changed

26 files changed

+4262
-2362
lines changed

.circleci/config.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ version: 2
22
jobs:
33
dependencies:
44
docker:
5-
- image: circleci/python:3.8.6-node
5+
- image: eventyay/circleci-python:py3.9
6+
environment:
7+
PIP_EXTRA_INDEX_URL: https://pypi.fury.io/fossasia/
68

79
working_directory: ~/code
810

@@ -12,16 +14,16 @@ jobs:
1214
# Download and cache dependencies
1315
- restore_cache:
1416
keys:
15-
- v1.5-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
17+
- v1.5.1-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
1618
# fallback to using the latest cache if no exact match is found
17-
- v1.5-dependencies-
19+
- v1.5.1-dependencies-
1820

1921
- run:
2022
name: Install Python Dependencies
2123
command: |
2224
python3 -m venv venv
2325
. venv/bin/activate
24-
poetry install
26+
poetry export -f requirements.txt --without-hashes --with dev | pip install -r /dev/stdin
2527
2628
- run:
2729
name: Install Node Dependencies
@@ -33,11 +35,11 @@ jobs:
3335
- ./node_modules
3436
- ~/.cache/yarn
3537
- ~/.yarn/bin
36-
key: v1.5-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
38+
key: v1.5.1-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
3739

3840
dredd:
3941
docker:
40-
- image: circleci/python:3.8.6-node
42+
- image: eventyay/circleci-python:py3.9
4143
environment:
4244
APP_CONFIG: config.TestingConfig
4345
DATABASE_URL: postgresql://postgres@localhost/test
@@ -58,9 +60,9 @@ jobs:
5860
# Download and cache dependencies
5961
- restore_cache:
6062
keys:
61-
- v1.5-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
63+
- v1.5.1-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
6264
# fallback to using the latest cache if no exact match is found
63-
- v1.5-dependencies-
65+
- v1.5.1-dependencies-
6466

6567
- run:
6668
name: Create API blueprint
@@ -80,7 +82,7 @@ jobs:
8082

8183
pytype:
8284
docker:
83-
- image: circleci/python:3.8.6-node
85+
- image: eventyay/circleci-python:py3.9
8486

8587
working_directory: ~/code
8688

@@ -90,17 +92,17 @@ jobs:
9092
# Download and cache dependencies
9193
- restore_cache:
9294
keys:
93-
- v1.5-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
95+
- v1.5.1-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
9496
# fallback to using the latest cache if no exact match is found
95-
- v1.5-dependencies-
97+
- v1.5.1-dependencies-
9698

9799
- restore_cache:
98100
keys:
99101
- v1-pytype
100102

101103
- run:
102104
name: Test pytype
103-
command: . venv/bin/activate && pytype
105+
command: ./venv/bin/pytype
104106

105107
- save_cache:
106108
paths:
@@ -109,7 +111,7 @@ jobs:
109111

110112
test:
111113
docker:
112-
- image: circleci/python:3.8.6-node
114+
- image: eventyay/circleci-python:py3.9
113115
environment:
114116
APP_CONFIG: config.TestingConfig
115117
DATABASE_URL: postgresql://postgres@localhost/test
@@ -131,9 +133,9 @@ jobs:
131133
# Download and cache dependencies
132134
- restore_cache:
133135
keys:
134-
- v1.5-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
136+
- v1.5.1-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
135137
# fallback to using the latest cache if no exact match is found
136-
- v1.5-dependencies-
138+
- v1.5.1-dependencies-
137139

138140
- run:
139141
name: Test
@@ -147,7 +149,7 @@ jobs:
147149
path: test-results
148150

149151
- store_artifacts:
150-
path: test-results
152+
path: test-results
151153

152154
- run:
153155
name: Upload Coverage

.github/workflows/docker-hub.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,37 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
-
16-
name: Login to DockerHub
17-
# The job will terminate early if Docker Hub credentials is not set.
18-
uses: docker/login-action@v1
19-
with:
20-
username: ${{ secrets.DOCKERHUB_USERNAME }}
21-
password: ${{ secrets.DOCKERHUB_TOKEN }}
16+
name: Checkout
17+
uses: actions/checkout@v3
18+
-
19+
name: Set up QEMU
20+
uses: docker/setup-qemu-action@v2
2221
-
2322
name: Set up Docker Buildx
24-
uses: docker/setup-buildx-action@v1
23+
uses: docker/setup-buildx-action@v2
2524
-
2625
name: Docker meta
27-
uses: docker/metadata-action@v3
26+
uses: docker/metadata-action@v4
2827
id: meta
2928
with:
30-
images: eventyay/open-event-server
29+
images: |
30+
eventyay/open-event-server
31+
tags: |
32+
type=ref,event=branch
33+
type=ref,event=pr
34+
type=semver,pattern={{version}}
35+
type=semver,pattern={{major}}.{{minor}}
3136
-
32-
name: Build
33-
id: docker_build
34-
uses: docker/build-push-action@v2
37+
name: Login to Docker Hub
38+
uses: docker/login-action@v2
3539
with:
36-
push: true
40+
username: ${{ secrets.DOCKERHUB_USERNAME }}
41+
password: ${{ secrets.DOCKERHUB_TOKEN }}
42+
-
43+
name: Build and push
44+
uses: docker/build-push-action@v4
45+
with:
46+
context: .
47+
push: ${{ github.event_name != 'pull_request' }}
3748
tags: ${{ steps.meta.outputs.tags }}
3849
labels: ${{ steps.meta.outputs.labels }}
39-
-
40-
name: Image digest
41-
run: echo ${{ steps.docker_build.outputs.digest }}

Dockerfile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ RUN apk update && \
1010
# PDF Generation: weasyprint (libffi-dev jpeg-dev already included above)
1111
RUN apk add --virtual gdk-pixbuf-dev
1212

13+
RUN apk --no-cache add postgresql-libs ca-certificates libxslt jpeg zlib file libxml2
14+
# PDF Generation: weasyprint
15+
RUN apk --no-cache add cairo-dev pango-dev ttf-opensans
16+
17+
# Note: The custom PyPI repo is for AlpineOS only, where Python packages are compiled with musl libc. Don't use it on glibc Linux.
1318
ENV POETRY_HOME=/opt/poetry \
1419
POETRY_VIRTUALENVS_IN_PROJECT=true \
15-
POETRY_NO_INTERACTION=1
20+
POETRY_NO_INTERACTION=1 \
21+
PIP_EXTRA_INDEX_URL=https://pypi.fury.io/fossasia/
1622

1723
ENV PATH="$POETRY_HOME/bin:$PATH"
1824

@@ -23,21 +29,21 @@ WORKDIR /opt/pysetup
2329
COPY pyproject.toml ./
2430
COPY poetry.lock ./
2531

26-
RUN poetry install --no-root --no-dev
32+
RUN poetry export -f requirements.txt --without-hashes --only main | poetry run pip install -r /dev/stdin
2733

2834
####
2935

3036
FROM base
3137

38+
# these libs are necessary for operation
39+
RUN apk --no-cache add libmagic cairo pango ttf-opensans && \
40+
apk --no-cache add postgresql-libs libxslt jpeg zlib libxml2 # those *might* be useful
41+
RUN fc-cache -f
42+
3243
COPY --from=builder /opt/pysetup/.venv /opt/pysetup/.venv
3344

3445
ENV PATH="/opt/pysetup/.venv/bin:$PATH"
3546

36-
RUN apk --no-cache add postgresql-libs ca-certificates libxslt jpeg zlib file libxml2
37-
# PDF Generation: weasyprint
38-
RUN apk --no-cache add cairo-dev pango-dev ttf-opensans
39-
RUN fc-cache -f
40-
4147
WORKDIR /data/app
4248
ADD . .
4349
RUN ["sh", "scripts/l10n.sh", "generate"]

app/api/helpers/calendar/ical.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,17 @@ def to_ical(event, include_sessions=False, my_schedule=False, user_id=None):
7272
else ""
7373
)
7474
session_link_heading = (
75-
" Join using link: " + session_video_url + "<br/>"
75+
" Join using link: " + session_video_url + " "
7676
if session_video_url
7777
else ""
7878
)
7979
session_description = (
8080
" "
8181
+ "Room: "
8282
+ session.microlocation.name
83-
+ "<br/>"
83+
+ " "
8484
+ session_link_heading
85-
+ " <br/> "
85+
+ " "
8686
+ session.short_abstract
8787
)
8888
session_component = Event()

app/api/helpers/custom_forms.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ def get_schema(form_fields):
1515
attrs = {}
1616

1717
for field in form_fields:
18-
if field.type in ['text', 'checkbox', 'select', 'paragraph']:
18+
if field.type in ['text', 'checkbox', 'select', 'paragraph', 'year', 'richtextlink']:
1919
field_type = marshmallow.fields.Str
2020
elif field.type == 'email':
2121
field_type = TrimmedEmail
2222
elif field.type == 'number':
2323
field_type = marshmallow.fields.Float
24+
elif field.type == 'boolean':
25+
field_type = marshmallow.fields.Boolean
2426
else:
2527
raise UnprocessableEntityError(
2628
{'pointer': '/data/complex-field-values/' + field.identifier},
@@ -45,7 +47,10 @@ def validate_custom_form_constraints(form, obj, excluded):
4547
if not getattr(obj, field.identifier):
4648
missing_required_fields.append(field.identifier)
4749
else:
48-
if not (obj.complex_field_values or {}).get(field.identifier):
50+
if obj.complex_field_values:
51+
if obj.complex_field_values.get(field.identifier) is None:
52+
missing_required_fields.append(field.identifier)
53+
else:
4954
missing_required_fields.append(field.identifier)
5055

5156
if len(missing_required_fields) > 0:

app/api/routes.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@
284284
VideoRecordingRelationship,
285285
)
286286
from app.api.video_stream import (
287+
ChatmosphereDetail,
287288
VideoStreamDetail,
288289
VideoStreamList,
289290
VideoStreamRelationship,
@@ -1863,6 +1864,11 @@
18631864
'/video-stream-moderators/<int:video_stream_moderator_id>/video-stream',
18641865
'/video-recordings/<int:video_recording_id>/video-stream',
18651866
)
1867+
api.route(
1868+
ChatmosphereDetail,
1869+
'chatmosphere_background',
1870+
'/events/<event_identifier>/chatmosphere'
1871+
)
18661872
api.route(
18671873
VideoStreamRelationship,
18681874
'video_stream_rooms',

app/api/schema/custom_forms.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class Meta:
4040
"email",
4141
"number",
4242
"paragraph",
43+
"richtextlink",
44+
"boolean",
45+
"year",
4346
]
4447
),
4548
)

app/api/schema/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class Meta:
9595
stripe_publishable_key = fields.Str(dump_only=True)
9696
stripe_test_client_id = fields.Str(dump_only=True)
9797
stripe_test_publishable_key = fields.Str(dump_only=True)
98+
stripe_mode = fields.Str(dump_only=True)
9899

99100
# PayPal Credentials
100101
paypal_mode = fields.Str(dump_only=True)
@@ -239,6 +240,7 @@ class Meta:
239240
stripe_test_client_id = fields.Str(allow_none=True)
240241
stripe_test_secret_key = fields.Str(allow_none=True)
241242
stripe_test_publishable_key = fields.Str(allow_none=True)
243+
stripe_mode = fields.Str(allow_none=True)
242244

243245
# PayPal Credentials
244246
paypal_mode = fields.Str(allow_none=True)

app/api/schema/video_stream.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ class VideoStreamExtraOptionsSchema(JsonSchema):
2121
endCurrentMeeting = fields.Boolean(default=False)
2222

2323

24+
class VideoStreamJitsiOptionsSchema(JsonSchema):
25+
muteOnStart = fields.Boolean(default=False)
26+
hideCamOnStart = fields.Boolean(default=False)
27+
28+
2429
class VideoStreamExtraSchema(JsonSchema):
2530
autoplay = fields.Boolean(default=True)
2631
loop = fields.Boolean(default=False)
2732
bbb_options = fields.Nested(VideoStreamExtraOptionsSchema, allow_none=True)
33+
jitsi_options = fields.Nested(VideoStreamJitsiOptionsSchema, allow_none=True)
2834

2935

3036
class VideoStreamSchema(Schema):
@@ -85,3 +91,16 @@ class Meta:
8591
schema='VideoStreamModeratorSchema',
8692
type_='video-stream-moderator',
8793
)
94+
95+
96+
class ChatmosphereSchema(Schema):
97+
class Meta:
98+
type_ = 'video-stream'
99+
self_view = 'v1.video_stream_detail'
100+
self_view_kwargs = {'id': '<id>'}
101+
inflect = dasherize
102+
103+
id = fields.Str(dump_only=True)
104+
name = fields.Str(required=True)
105+
url = fields.Url(required=True)
106+
bg_img_url = fields.Str(required=False, allow_none=True)

0 commit comments

Comments
 (0)