Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add twitter verification for grants #7367

Merged
merged 7 commits into from
Sep 14, 2020

Conversation

zoek1
Copy link
Contributor

@zoek1 zoek1 commented Sep 13, 2020

@codecov
Copy link

codecov bot commented Sep 13, 2020

Codecov Report

Merging #7367 into round-7-integration will increase coverage by 0.00%.
The diff coverage is 27.65%.

Impacted file tree graph

@@                 Coverage Diff                  @@
##           round-7-integration    #7367   +/-   ##
====================================================
  Coverage                26.32%   26.32%           
====================================================
  Files                      306      306           
  Lines                    30317    30373   +56     
  Branches                  4477     4486    +9     
====================================================
+ Hits                      7981     7997   +16     
- Misses                   22061    22106   +45     
+ Partials                   275      270    -5     
Impacted Files Coverage Δ
app/grants/admin.py 47.05% <ø> (ø)
app/grants/urls.py 100.00% <ø> (ø)
app/grants/views.py 14.40% <13.88%> (-0.31%) ⬇️
app/grants/utils.py 24.09% <62.50%> (+3.04%) ⬆️
app/grants/models.py 42.51% <100.00%> (+0.25%) ⬆️
app/dashboard/models.py 49.70% <0.00%> (-0.15%) ⬇️
app/quests/views.py 16.22% <0.00%> (ø)
app/dashboard/views.py 10.49% <0.00%> (ø)
...rketing/management/commands/no_applicants_email.py 0.00% <0.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2bdb362...9796e53. Read the comment docs.

@@ -364,6 +364,9 @@ class Meta:

# Grant Query Set used as manager.
objects = GrantQuerySet.as_manager()
verified = models.BooleanField(default=False)
verified_by = models.ForeignKey('dashboard.Profile', null=True, blank=True, on_delete=models.SET_NULL)
verified_at = models.DateTimeField(blank=True, null=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ Is this meant only for twitter ! If so rename all by adding prefix twitter
Also also help_text attribute explaining what it is (even if it's obvious)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -16,7 +16,7 @@
{% endcomment %}
{% load static humanize i18n grants_extra %}
<!DOCTYPE html>
<html lang="en">
<html lang="en" xmlns="http://www.w3.org/1999/html">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member

@thelostone-mc thelostone-mc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a few comments


.verification__warning__icon {
font-size: 2.8rem;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't this be shifted to the css file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

data-size="small"
data-text="I am verifying my ownership of the {{ grant.title }}. \n{{ user_code }}\n"
data-url="https://gitcoin.co{{ grant.get_absolute_url }}"
data-hashtags="grants,round7">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not hardcode round7! make it dynamic by looking at active_clr column


</div>
<div class="modal-footer" style="border-top: none">
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nop, i removed it

</div>
</div>
</div>
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ could we reduce the overall size of this to make it look neater ? It looks very big on the screenshot

app/grants/utils.py Show resolved Hide resolved
'msg': 'Grant doesn\'t exists'
})

grant = grants.first()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ could we do a grants.object.get ? every grant is unique
If we have duplicate entries -> something is wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@zoek1 zoek1 marked this pull request as ready for review September 14, 2020 03:53
})

user_code = get_user_code(request.user.profile.id, emoji_codes)
text = f"I am verifying my ownership of the { grant.title }"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    text = f"I am verifying my ownership of {grant.title } on Gitcoin Grants at {URL}"

pls

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

has_code = user_code in last_tweet.full_text
has_text = text in last_tweet.full_text

if has_code and has_text:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noob question, this checks the username of the twitter account + grant id, so that i cant do a URL param attack on the endpoint.. right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it verifies for twitter account + grant id + is member of this grant + the generated emoji code corresponds to the given grant and users that is verifying.

@octavioamu
Copy link
Contributor

todo
use https://developer.twitter.com/en/docs/twitter-for-websites/tweet-button/guides/web-intent instead of sdk
recreate migrations

@octavioamu octavioamu merged commit 7118fae into gitcoinco:round-7-integration Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants