Skip to content

Commit

Permalink
Merge pull request #4781 from gitcoinco/fix/invite-bounty
Browse files Browse the repository at this point in the history
Fix invite to work on a bounty detail and user directory
  • Loading branch information
octavioamu authored Jul 17, 2019
2 parents 7a5761d + 0235146 commit 0ba380b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/assets/v2/js/pages/bounty_share.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $('.modal-link').click(function(e) {
const sendInvites = (users) => {
let usersId = [];
let msg = $('#shareText').val();
const url = document.issueURL;
const bountyId = document.result.pk;

$.each(users, function(index, elem) {
usersId.push(elem.id);
Expand All @@ -30,7 +30,7 @@ const sendInvites = (users) => {
var sendEmail = fetchData(
'/api/v0.1/social_contribution_email/',
'POST',
{usersId, msg, url, invite_url},
{usersId, msg, bountyId, invite_url},
{'X-CSRFToken': csrftoken}
);

Expand Down
2 changes: 1 addition & 1 deletion app/assets/v2/js/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Vue.mixin({
let postInvite = fetchData(
apiUrlInvite,
'POST',
{ 'url': bounty.github_url, 'usersId': [user], 'bountyId': bounty.id},
{ 'usersId': [user], 'bountyId': bounty.id},
{'X-CSRFToken': csrftoken}
);

Expand Down
5 changes: 2 additions & 3 deletions app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1136,14 +1136,13 @@ def social_contribution_email(request):

emails = []
user_ids = request.POST.getlist('usersId[]', [])
url = request.POST.get('url', '')
invite_url = request.POST.get('invite_url', '')
bounty_id = request.POST.get('bountyId')
if not invite_url:
bounty_id = request.POST.get('bountyId')
invite_url = f'{settings.BASE_URL}issue/{get_bounty_invite_url(request.user.username, bounty_id)}'

inviter = request.user if request.user.is_authenticated else None
bounty = Bounty.objects.current().get(github_url=url)
bounty = Bounty.objects.current().get(id=int(bounty_id))
for user_id in user_ids:
profile = Profile.objects.get(id=int(user_id))
bounty_invite = BountyInvites.objects.create(
Expand Down

0 comments on commit 0ba380b

Please sign in to comment.