Skip to content

Commit

Permalink
Drops a Grants Twitter verification if the user modifies the twitter_…
Browse files Browse the repository at this point in the history
…handle_1 field (gitcoinco#8305)

* Drops a Grants Twitter verification if the user modifies the twitter_handle_1 field

* Updates front-end to catch twitter_handle_1 edits
  • Loading branch information
gdixon authored Jan 26, 2021
1 parent 3a91008 commit 7dcab26
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/assets/v2/js/grants/_detail-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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));
Expand Down
7 changes: 6 additions & 1 deletion app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7dcab26

Please sign in to comment.