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

Bug/4817 abuse of invite system #4945

Merged
merged 3 commits into from
Aug 5, 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
2 changes: 1 addition & 1 deletion app/assets/v2/js/pages/bounty_share.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const sendInvites = (users) => {
var sendEmail = fetchData(
'/api/v0.1/social_contribution_email/',
'POST',
{usersId, msg, bountyId, invite_url},
{usersId, msg, bountyId},
{'X-CSRFToken': csrftoken}
);

Expand Down
1 change: 0 additions & 1 deletion app/dashboard/templates/social_contribution_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,4 @@ <h4>{% trans "Click to instantly share on the following networks" %}</h4>
{% csrf_token %}
<script type="text/javascript">
var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
var invite_url = '{{invite_url}}';
</script>
6 changes: 2 additions & 4 deletions app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,11 +1137,9 @@ def social_contribution_email(request):
from .utils import get_bounty_invite_url

emails = []
user_ids = request.POST.getlist('usersId[]', [])
invite_url = request.POST.get('invite_url', '')
bounty_id = request.POST.get('bountyId')
if not invite_url:
invite_url = f'{settings.BASE_URL}issue/{get_bounty_invite_url(request.user.username, bounty_id)}'
user_ids = request.POST.getlist('usersId[]', [])
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(id=int(bounty_id))
Expand Down