From 3d33f33380a17717d2ca5c6c15686162f788236c Mon Sep 17 00:00:00 2001 From: Graham Dixon Date: Tue, 26 Jan 2021 01:11:30 +0000 Subject: [PATCH 1/2] Drops a Grants Twitter verification if the user modifies the twitter_handle_1 field --- app/grants/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) From 1578a198932844d8d1c99df52598907407a36b04 Mon Sep 17 00:00:00 2001 From: Graham Dixon Date: Tue, 26 Jan 2021 08:01:50 +0000 Subject: [PATCH 2/2] Updates front-end to catch twitter_handle_1 edits --- app/assets/v2/js/grants/_detail-component.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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));