Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apollo/api/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from flask import jsonify
from flask_babel import gettext as _
from loguru import logger

from apollo.core import red

Expand All @@ -12,6 +13,7 @@ def process_expired_token(jwt_header, jwt_payload):
'status': _('error'),
'message': _('Token has expired')
})
logger.debug(response)
response.status_code = HTTPStatus.UNAUTHORIZED
return response

Expand All @@ -21,6 +23,7 @@ def process_invalid_token(reason):
'status': _('error'),
'message': _(reason)
})
logger.debug(response)
response.status_code = HTTPStatus.UNPROCESSABLE_ENTITY
return response

Expand All @@ -30,6 +33,7 @@ def process_revoked_token(jwt_header, jwt_payload):
'status': _('error'),
'message': _('Token has been revoked')
})
logger.debug(response)
response.status_code = HTTPStatus.UNAUTHORIZED
return response

Expand Down
4 changes: 2 additions & 2 deletions apollo/pwa/static/js/serviceworker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const CACHE_NAME = 'apollo-cache-static-v11';
const CACHE_NAME = 'apollo-cache-static-v13';

const CACHED_URLS = [
'/pwa/',
Expand All @@ -23,7 +23,7 @@ const CACHED_URLS = [
'/pwa/static/vendor/notiflix/notiflix-2.7.0.min.js',
'/pwa/static/vendor/popper.js/popper.min.js',
'/pwa/static/vendor/tippy.js/tippy.umd.min.js',
'/pwa/static/vendor/sentry/bundle.min.js',
'/pwa/static/vendor/sentry/bundle.tracing.min.js',
'/pwa/static/vendor/vue/vue.min.js',
];

Expand Down
4 changes: 2 additions & 2 deletions apollo/pwa/static/vendor/sentry/bundle.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion apollo/pwa/static/vendor/sentry/bundle.min.js.map

This file was deleted.

3 changes: 3 additions & 0 deletions apollo/pwa/static/vendor/sentry/bundle.tracing.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apollo/pwa/templates/pwa/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"
</span>
</template>
{% if trace_errors %}
<script src="{{ url_for('pwa.static', filename='vendor/sentry/bundle.min.js') }}"></script>
<script src="{{ url_for('pwa.static', filename='vendor/sentry/bundle.tracing.min.js') }}"></script>
{% endif %}
<script src="{{ url_for('pwa.static', filename='vendor/popper.js/popper.min.js') }}"></script>
<script src="{{ url_for('pwa.static', filename='vendor/autocomplete/autocomplete.min.js') }}"></script>
Expand Down
2 changes: 1 addition & 1 deletion apollo/pwa/views_pwa.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def index():
"""Index view for the PWA."""
commit = current_app.config["COMMIT"] or current_app.config["VERSION"]

trace_errors = current_app.config["DEBUG"]
trace_errors = current_app.config["SENTRY_CAPTURE_FRONTEND"]
sentry_dsn = current_app.config["SENTRY_DSN"] or ""

context = {"commit": commit, "trace_errors": trace_errors}
Expand Down
1 change: 1 addition & 0 deletions apollo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

SENTRY_DSN = config("SENTRY_DSN", default=None)
SENTRY_USER_ATTRS = ["email"]
SENTRY_CAPTURE_FRONTEND = config("SENTRY_CAPTURE_FRONTEND", cast=config.boolean, default=False)

MAIL_SERVER = config("MAIL_SERVER", default=None)
MAIL_PORT = config("MAIL_PORT", default=None)
Expand Down
17 changes: 11 additions & 6 deletions apollo/submissions/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from flask_babel import gettext
from flask_jwt_extended import get_jwt_identity, jwt_required
from flask_security.decorators import login_required
from loguru import logger
from marshmallow import ValidationError
from slugify import slugify
from sqlalchemy.exc import ProgrammingError
Expand Down Expand Up @@ -140,6 +141,7 @@ def checklist_qa_status(uuid):
'status': 'error'
}

logger.debug(response_body)
response = jsonify(response_body)
response.status_code = HTTPStatus.BAD_REQUEST
return response
Expand All @@ -152,7 +154,7 @@ def checklist_qa_status(uuid):
'message': gettext('Invalid checklist'),
'status': 'error'
}

logger.debug(response_body)
response = jsonify(response_body)
response.status_code = HTTPStatus.BAD_REQUEST
return response
Expand Down Expand Up @@ -182,7 +184,7 @@ def submission():
'message': gettext('Invalid data sent'),
'status': 'error'
}

logger.debug(response_body)
response = jsonify(response_body)
response.status_code = HTTPStatus.BAD_REQUEST
return response
Expand All @@ -198,7 +200,7 @@ def submission():
'message': gettext('Invalid form'),
'status': 'error'
}

logger.debug(response_body)
response = jsonify(response_body)
response.status_code = HTTPStatus.BAD_REQUEST
return response
Expand All @@ -210,7 +212,7 @@ def submission():
'message': gettext('Invalid participant'),
'status': 'error'
}

logger.debug(response_body)
response = jsonify(response_body)
response.status_code = HTTPStatus.BAD_REQUEST
return response
Expand All @@ -221,7 +223,7 @@ def submission():
'message': gettext('Invalid participant'),
'status': 'error'
}

logger.debug(response_body)
response = jsonify(response_body)
response.status_code = HTTPStatus.BAD_REQUEST
return response
Expand All @@ -238,7 +240,7 @@ def submission():
'status': 'error',
'errorFields': error_fields,
}

logger.debug(response_body)
response = jsonify(response_body)
response.status_code = HTTPStatus.BAD_REQUEST
return response
Expand Down Expand Up @@ -294,6 +296,7 @@ def submission():
'message': gettext('Could not update data. Please check your ID'),
'status': 'error'
}
logger.debug(response_body)
response = jsonify(response_body)
response.status_code = HTTPStatus.BAD_REQUEST
return response
Expand Down Expand Up @@ -435,6 +438,7 @@ def submission():
def get_image_manifest(**kwargs):
if not permissions.export_submissions.can():
response_body = {'images': [], 'status': 'error'}
logger.debug(response_body)
response = jsonify(response_body)
response.status_code = HTTPStatus.FORBIDDEN
return response
Expand Down Expand Up @@ -496,6 +500,7 @@ def _generate_filename(attachment: SubmissionImageAttachment, tag=None):
'images': [],
'status': 'error',
})
logger.debug(response_body)
response.status_code = HTTPStatus.UNPROCESSABLE_ENTITY

return response
Expand Down