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

Fix invite to work on a bounty detail and user directory #4781

Merged
merged 4 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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