Skip to content

Commit e2341cc

Browse files
chore: Release v1.10.0 (#6687)
chore: Release v1.10.0
2 parents 36e20e9 + f54d0c4 commit e2341cc

33 files changed

+259
-136
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ DATABASE_URL=postgresql://open_event_user:[email protected]:5432/oevent
22
INTEGRATE_SOCKETIO=false
33
TEST_DATABASE_URL=postgresql://open_event_user:[email protected]:5432/opev_test
44
APP_CONFIG=config.DevelopmentConfig
5-
ENABLE_ELASTICSEARCH=true
5+
ENABLE_ELASTICSEARCH=false
66
ELASTICSEARCH_HOST=localhost:9200
77

88
POSTGRES_USER=open_event_user

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
## Changelog
22

3+
##### v1.10.0 (2019-12-22):
4+
5+
- Fix event and speaker image resizing, and add management command to resize event and speaker images which remained to be resized.
6+
Run `python manage.py fix_event_and_speaker_images` to resize images which weren't resized due to the bug
7+
- Optimize link generation of relationships with up to 10X speedup
8+
- Add scheduled job to automatically remove orphan ticket holders with no order ID
9+
- Add created and modified times in ticket holder
10+
- Allow new tickets to have same name as deleted tickets
11+
- Fix PayTM payment gateway
12+
313
##### v1.9.0 (2019-11-28):
414

515
- Fix billing info requirements from attendees

Dockerfile

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
FROM python:3.7.4-alpine as base
2-
LABEL maintainer="Niranjan Rajendran <[email protected]>"
1+
FROM python:3.7-alpine as base
32

43
####
54

@@ -9,25 +8,19 @@ WORKDIR /install
98

109
RUN apk update && \
1110
apk add --virtual build-deps git gcc python3-dev musl-dev jpeg-dev zlib-dev libevent-dev file-dev libffi-dev openssl && \
12-
apk add postgresql-dev && \
13-
pip install setuptools
11+
apk add postgresql-dev
1412

1513
ADD requirements.txt /requirements.txt
1614
ADD requirements /requirements/
1715

18-
RUN wget https://bootstrap.pypa.io/ez_setup.py && python ez_setup.py
19-
20-
ENV PYTHONPATH /install/lib/python3.7/site-packages
21-
RUN pip install --install-option="--prefix=/install" setuptools && \
22-
LIBRARY_PATH=/lib:/usr/lib pip install --install-option="--prefix=/install" -r /requirements.txt
16+
RUN pip install --prefix=/install --no-warn-script-location -r /requirements.txt
2317

2418
####
2519

2620
FROM base
2721

2822
COPY --from=builder /install /usr/local
29-
RUN apk --no-cache add postgresql-dev ca-certificates libxslt jpeg zlib file libxml2 git && \
30-
pip install git+https://github.com/fossasia/[email protected]#egg=flask-rest-jsonapi
23+
RUN apk --no-cache add postgresql-libs ca-certificates libxslt jpeg zlib file libxml2
3124

3225
WORKDIR /data/app
3326
ADD . .

app/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from flask_login import current_user
1919
from flask_jwt_extended import JWTManager
2020
from flask_limiter import Limiter
21+
from flask_limiter.util import get_ipaddr
2122
from datetime import timedelta
2223
from flask_cors import CORS
2324
from flask_rest_jsonapi.errors import jsonapi_errors
@@ -40,7 +41,8 @@
4041
from app.api.helpers.auth import AuthManager, is_token_blacklisted
4142
from app.api.helpers.scheduled_jobs import send_after_event_mail, send_event_fee_notification, \
4243
send_event_fee_notification_followup, change_session_state_on_event_completion, \
43-
expire_pending_tickets, send_monthly_event_invoice, event_invoices_mark_due
44+
expire_pending_tickets, send_monthly_event_invoice, event_invoices_mark_due, \
45+
delete_ticket_holders_no_order_id
4446
from app.models.event import Event
4547
from app.models.role_invite import RoleInvite
4648
from app.views.healthcheck import health_check_celery, health_check_db, health_check_migrations, check_migrations
@@ -49,14 +51,15 @@
4951
from app.views.redis_store import redis_store
5052
from app.views.celery_ import celery
5153
from app.templates.flask_ext.jinja.filters import init_filters
54+
from app.extensions import shell
5255

5356

5457
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
5558

5659
static_dir = os.path.dirname(os.path.dirname(__file__)) + "/static"
5760
template_dir = os.path.dirname(__file__) + "/templates"
5861
app = Flask(__name__, static_folder=static_dir, template_folder=template_dir)
59-
limiter = Limiter(app)
62+
limiter = Limiter(app, key_func=get_ipaddr)
6063
env.read_envfile()
6164

6265

@@ -196,6 +199,8 @@ def create_app():
196199
# redis
197200
redis_store.init_app(app)
198201

202+
shell.init_app(app)
203+
199204
# elasticsearch
200205
if app.config['ENABLE_ELASTICSEARCH']:
201206
client.init_app(app)
@@ -270,6 +275,7 @@ def update_sent_state(sender=None, headers=None, **kwargs):
270275
scheduler.add_job(expire_pending_tickets, 'cron', minute=45)
271276
scheduler.add_job(send_monthly_event_invoice, 'cron', day=1, month='1-12')
272277
scheduler.add_job(event_invoices_mark_due, 'cron', hour=5)
278+
scheduler.add_job(delete_ticket_holders_no_order_id, 'cron', minute=5)
273279
scheduler.start()
274280

275281

app/api/auth.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
current_user, create_access_token,
1414
create_refresh_token, set_refresh_cookies,
1515
get_jwt_identity)
16-
from flask_limiter.util import get_remote_address
1716
from healthcheck import EnvironmentDump
1817
from sqlalchemy.orm.exc import NoResultFound
1918

@@ -289,7 +288,7 @@ def resend_verification_email():
289288
'3/hour', key_func=lambda: request.json['data']['email'], error_message='Limit for this action exceeded'
290289
)
291290
@limiter.limit(
292-
'1/minute', key_func=get_remote_address, error_message='Limit for this action exceeded'
291+
'1/minute', error_message='Limit for this action exceeded'
293292
)
294293
def reset_password_post():
295294
try:

app/api/custom/orders.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from flask import Blueprint, jsonify, request
22
from flask_jwt_extended import current_user, jwt_required
3-
from flask_limiter.util import get_remote_address
43
from sqlalchemy.orm.exc import NoResultFound
54

65

@@ -50,7 +49,7 @@ def ticket_attendee_authorized(order_identifier):
5049
'5/minute', key_func=lambda: request.json['data']['user'], error_message='Limit for this action exceeded'
5150
)
5251
@limiter.limit(
53-
'60/minute', key_func=get_remote_address, error_message='Limit for this action exceeded'
52+
'60/minute', error_message='Limit for this action exceeded'
5453
)
5554
def resend_emails():
5655
"""

app/api/events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def validate_event(user, modules, data):
5656
if not user.can_create_event():
5757
raise ForbiddenException({'source': ''},
5858
"Please verify your Email")
59-
elif data.get('is_ticketing_enabled', True) and not modules.ticket_include:
60-
raise ForbiddenException({'source': '/data/attributes/is-ticketing-enabled'},
59+
elif not modules.ticket_include:
60+
raise ForbiddenException({'source': ''},
6161
"Ticketing is not enabled in the system")
6262
if data.get('can_pay_by_paypal', False) or data.get('can_pay_by_cheque', False) or \
6363
data.get('can_pay_by_bank', False) or data.get('can_pay_by_stripe', False):

app/api/helpers/checksum.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ def __encode__(to_encode, iv, key):
102102
# Pad
103103
to_encode = __pad__(to_encode)
104104
# Encrypt
105-
c = AES.new(key, AES.MODE_CBC, iv)
106-
to_encode = c.encrypt(to_encode)
105+
c = AES.new(key.encode('UTF-8'), AES.MODE_CBC, iv.encode('UTF-8'))
106+
to_encode = c.encrypt(to_encode.encode('UTF-8'))
107107
# Encode
108108
to_encode = base64.b64encode(to_encode)
109109
return to_encode.decode("UTF-8")
@@ -113,7 +113,7 @@ def __decode__(to_decode, iv, key):
113113
# Decode
114114
to_decode = base64.b64decode(to_decode)
115115
# Decrypt
116-
c = AES.new(key, AES.MODE_CBC, iv)
116+
c = AES.new(key.encode('UTF-8'), AES.MODE_CBC, iv.encode('UTF-8'))
117117
to_decode = c.decrypt(to_decode)
118118
if type(to_decode) == bytes:
119119
# convert bytes array to str.

app/api/helpers/files.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import urllib.parse
66
import urllib.request
77
import uuid
8+
import requests
89

910
import PIL
1011
from PIL import Image
@@ -77,7 +78,7 @@ def create_save_resized_image(image_file, basewidth=None, maintain_aspect=None,
7778
if not image_file:
7879
return None
7980
filename = '{filename}.{ext}'.format(filename=get_file_name(), ext=ext)
80-
data = urllib.request.urlopen(image_file).read()
81+
data = requests.get(image_file).content
8182
image_file = io.BytesIO(data)
8283
try:
8384
im = Image.open(image_file)
@@ -129,7 +130,14 @@ def create_save_image_sizes(image_file, image_sizes_type, unique_identifier=None
129130
try:
130131
image_sizes = ImageSizes.query.filter_by(type=image_sizes_type).one()
131132
except NoResultFound:
132-
image_sizes = ImageSizes(image_sizes_type, 1300, 500, True, 100, 75, 30, True, 100, 500, 200, True, 100)
133+
image_sizes = ImageSizes(image_sizes_type, full_width=1300,
134+
full_height=500, full_aspect=True, full_quality=80,
135+
icon_width=75, icon_height=30, icon_aspect=True,
136+
icon_quality=80, thumbnail_width=500, thumbnail_height=200,
137+
thumbnail_aspect=True, thumbnail_quality=80, logo_width=500,
138+
logo_height=200, icon_size_width_height=35, icon_size_quality=80,
139+
small_size_width_height=50, small_size_quality=80,
140+
thumbnail_size_width_height=500)
133141

134142
# Get an unique identifier from uuid if not provided
135143
if unique_identifier is None:

app/api/helpers/mail.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,18 +363,21 @@ def send_email_to_attendees(order, purchaser_id, attachments=None):
363363

364364

365365
def send_order_cancel_email(order):
366+
cancel_msg = ''
367+
if order.cancel_note:
368+
cancel_msg = u"<br/>Message from the organizer: {cancel_note}".format(cancel_note=order.cancel_note)
369+
366370
send_email(
367371
to=order.user.email,
368372
action=TICKET_CANCELLED,
369373
subject=MAILS[TICKET_CANCELLED]['subject'].format(
370374
event_name=order.event.name,
371375
invoice_id=order.invoice_number,
372-
frontend_url=get_settings()['frontend_url']
373376
),
374377
html=MAILS[TICKET_CANCELLED]['message'].format(
375378
event_name=order.event.name,
376-
order_url=make_frontend_url('/orders/{identifier}'.format(identifier=order.identifier)),
377-
cancel_note=order.cancel_note,
378-
frontend_url=get_settings()['frontend_url']
379+
frontend_url=get_settings()['frontend_url'],
380+
cancel_msg=cancel_msg,
381+
app_name=get_settings()['app_name']
379382
)
380383
)

0 commit comments

Comments
 (0)