From 7dcab26da111667c20671e9b0bde5713aa8dbe16 Mon Sep 17 00:00:00 2001 From: Graham Dixon Date: Tue, 26 Jan 2021 18:08:05 +0000 Subject: [PATCH] Drops a Grants Twitter verification if the user modifies the twitter_handle_1 field (#8305) * Drops a Grants Twitter verification if the user modifies the twitter_handle_1 field * Updates front-end to catch twitter_handle_1 edits --- app/assets/v2/js/grants/_detail-component.js | 6 +++++- app/grants/views.py | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/assets/v2/js/grants/_detail-component.js b/app/assets/v2/js/grants/_detail-component.js index 2fe6da34fe2..6c1b1d2be2b 100644 --- a/app/assets/v2/js/grants/_detail-component.js +++ b/app/assets/v2/js/grants/_detail-component.js @@ -97,6 +97,10 @@ Vue.mixin({ vm.grant.description_rich = JSON.stringify(vm.$refs.myQuillEditor.quill.getContents()); vm.grant.description = vm.$refs.myQuillEditor.quill.getText(); vm.grant.image_css = `background-color: ${vm.logoBackground};`; + if (vm.grant_twitter_handle_1 != vm.grant.twitter_handle_1) { + vm.grant.verified = false; + } + vm.grant_twitter_handle_1 = vm.grant.twitter_handle_1; vm.$root.$emit('bv::toggle::collapse', 'sidebar-grant-edit'); _alert('Updated grant.', 'success'); @@ -532,7 +536,7 @@ Vue.component('grant-details', { }, mounted: function() { let vm = this; - + vm.grant_twitter_handle_1 = vm.grant.twitter_handle_1; vm.grant.description_rich_edited = vm.grant.description_rich; if (vm.grant.description_rich_edited) { vm.editor.updateContents(JSON.parse(vm.grant.description_rich)); diff --git a/app/grants/views.py b/app/grants/views.py index f34c423ba3c..f4b4eb69943 100644 --- a/app/grants/views.py +++ b/app/grants/views.py @@ -1623,7 +1623,12 @@ def grant_edit(request, grant_id): response['message'] = 'error: enter your twitter handle e.g @georgecostanza' return JsonResponse(response) - grant.twitter_handle_1 = twitter_handle_1 + if grant.twitter_handle_1 != twitter_handle_1: + grant.twitter_verified = False + grant.twitter_verified_by = None + grant.twitter_verified_at = None + grant.twitter_handle_1 = twitter_handle_1 + grant.twitter_handle_2 = twitter_handle_2 reference_url = request.POST.get('reference_url', None)