From ecd5d23d3fe16fa2f7b7f6a21a0d8562460038f9 Mon Sep 17 00:00:00 2001 From: Chris Veilleux Date: Tue, 18 Jun 2019 15:11:28 -0500 Subject: [PATCH] changes to the open dataset opt-in flag are not being synced to the device because the etag is not expired when the change is made. --- shared/selene/api/endpoints/account.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shared/selene/api/endpoints/account.py b/shared/selene/api/endpoints/account.py index eee68f43..911783c2 100644 --- a/shared/selene/api/endpoints/account.py +++ b/shared/selene/api/endpoints/account.py @@ -25,12 +25,14 @@ from selene.util.auth import ( get_facebook_account_email, get_google_account_email ) +from selene.util.cache import SeleneCache from selene.util.payment import ( cancel_stripe_subscription, create_stripe_account, create_stripe_subscription ) from ..base_endpoint import SeleneEndpoint +from ..etag import ETagManager MONTHLY_MEMBERSHIP = 'Monthly Membership' YEARLY_MEMBERSHIP = 'Yearly Membership' @@ -232,11 +234,17 @@ class AccountEndpoint(SeleneEndpoint): response_data = dict(errors=errors) response_status = HTTPStatus.BAD_REQUEST else: + self._expire_device_setting_cache() response_data = '' response_status = HTTPStatus.NO_CONTENT return response_data, response_status + def _expire_device_setting_cache(self): + cache = SeleneCache() + etag_manager = ETagManager(cache, self.config) + etag_manager.expire_device_setting_etag_by_account_id(self.account.id) + def _update_account(self): errors = [] for key, value in self.request.json.items():