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

purge: remove private bounties #6305

Merged
merged 7 commits into from
Apr 8, 2020
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
519 changes: 166 additions & 353 deletions app/app/fixtures/dashboard.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@
),
url(r'^api/v0.1/org_perms', dashboard.views.org_perms, name='org_perms'),
url(r'^api/v0.1/bulk_invite', dashboard.views.bulk_invite, name='bulk_invite'),
url(r'^api/v0.1/bountydocument', dashboard.views.bounty_upload_nda, name='bounty_upload_nda'),
url(r'^api/v0.1/faucet/save/?', faucet.views.save_faucet, name='save_faucet'),
url(r'^api/v0.1/', include(dbrouter.urls)),
url(r'^api/v0.1/', include(kdrouter.urls)),
Expand Down
19 changes: 0 additions & 19 deletions app/assets/v2/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1545,25 +1545,6 @@ div.busyOverlay {
border-radius: 100px;
}

.cta-blue {
background: #0D0764;
color: white;
padding: 1.8rem;
border-radius: 0.2rem;
}

.privaterepo-instructions {
color: grey;
padding-top: 1rem;
}

@media (min-width: 768px) {
.privaterepo-instructions {
width: 75%;
}

}

.g-modal .modal-header,
.g-modal .modal-footer {
border: none;
Expand Down
Binary file removed app/assets/v2/images/emails/private-repo-1.png
Binary file not shown.
Binary file removed app/assets/v2/images/emails/private-repo-2.png
Binary file not shown.
Binary file removed app/assets/v2/images/emails/private-repo-3.png
Binary file not shown.
Binary file removed app/assets/v2/images/emails/private-repo-4.png
Binary file not shown.
Binary file removed app/assets/v2/images/repo-instructions.png
Binary file not shown.
Binary file removed app/assets/v2/images/repo-settings.png
Binary file not shown.
1 change: 0 additions & 1 deletion app/assets/v2/images/robots-party.svg

This file was deleted.

136 changes: 18 additions & 118 deletions app/assets/v2/js/pages/bounty_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,12 +696,8 @@ var show_interest_modal = function() {

modals.on('show.bs.modal', function() {
modalBody.load(modalUrl, ()=> {
if (document.result['repo_type'] === 'private') {
document.result.unsigned_nda ? $('.nda-download-link').attr('href', document.result.unsigned_nda.doc) : $('#nda-upload').hide();
}

let actionPlanForm = $('#action_plan');
let discord_username = $('#discord_username');
let issueMessage = $('#issue_message');

issueMessage.attr('placeholder', gettext('What steps will you take to complete this task? (min 30 chars)'));
Expand All @@ -716,69 +712,24 @@ var show_interest_modal = function() {
return false;
}

const issueNDA = document.result['repo_type'] === 'private' ? $('#issueNDA')[0].files : undefined;

if (issueNDA && typeof issueNDA[0] !== 'undefined') {

const formData = new FormData();

formData.append('docs', issueNDA[0]);
formData.append('doc_type', 'signed_nda');

const ndaSend = {
url: '/api/v0.1/bountydocument',
method: 'POST',
data: formData,
processData: false,
dataType: 'json',
contentType: false
};

$.ajax(ndaSend).done(function(response) {
if (response.status == 200) {
_alert(response.message, 'info');
add_interest(document.result['pk'], {
issue_message: msg,
signed_nda: response.bounty_doc_id,
discord_username: $('#discord_username').length ? $('#discord_username').val() : null
}).then(success => {
if (success) {
$(self).attr('href', '/uninterested');
$(self).find('span').text(gettext('Stop Work'));
$(self).parent().attr('title', '<div class="tooltip-info tooltip-sm">' + gettext('Notify the funder that you will not be working on this project') + '</div>');
modals.bootstrapModal('hide');
}
}).catch((error) => {
if (error.responseJSON.error === 'You may only work on max of 3 issues at once.')
return;
throw error;
});
} else {
_alert(response.message, 'error');
}
}).fail(function(error) {
_alert(error, 'error');
});
} else {
add_interest(document.result['pk'], {
issue_message: msg,
discord_username: $('#discord_username').length ? $('#discord_username').val() : null
}).then(success => {
if (success) {
$(self).attr('href', '/uninterested');
$(self).find('span').text(gettext('Stop Work'));
$(self).parent().attr('title', '<div class="tooltip-info tooltip-sm">' + gettext('Notify the funder that you will not be working on this project') + '</div>');
modals.bootstrapModal('hide');
if (document.result.event) {
projectModal(document.result.pk);
}
add_interest(document.result['pk'], {
issue_message: msg,
discord_username: $('#discord_username').length ? $('#discord_username').val() : null
}).then(success => {
if (success) {
$(self).attr('href', '/uninterested');
$(self).find('span').text(gettext('Stop Work'));
$(self).parent().attr('title', '<div class="tooltip-info tooltip-sm">' + gettext('Notify the funder that you will not be working on this project') + '</div>');
modals.bootstrapModal('hide');
if (document.result.event) {
projectModal(document.result.pk);
}
}).catch((error) => {
if (error.responseJSON.error === 'You may only work on max of 3 issues at once.')
return;
throw error;
});
}
}
}).catch((error) => {
if (error.responseJSON.error === 'You may only work on max of 3 issues at once.')
return;
throw error;
});

});

Expand All @@ -787,45 +738,6 @@ var show_interest_modal = function() {
modals.bootstrapModal('show');
};

const repoInstructions = () => {
let linkToSettings = `https://github.com/${document.result.github_org_name}/${document.result.github_repo_name}/settings/collaboration`;


let modalTmp = `
<div class="modal fade g-modal" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body text-center center-block w-75">
<h5>
You have successfully approved the contributor to work on your bounty!
</h5>
<div>
<img src="${document.contxt.STATIC_URL}v2/images/repo-instructions.png" class="mw-100 my-4" alt="">
</div>
<p class="mb-4">Now you need to invite the contributor to your private repo on GitHub You can find it under <b>GitHub repository > Settings > Collaborators</b></p>
<div>
<img src="${document.contxt.STATIC_URL}v2/images/repo-settings.png" class="mw-100" alt="">
</div>
</div>
<div class="modal-footer justify-content-center">
<a href="${linkToSettings}" target="_blank" class="button button--primary"><i class="fab fa-github"></i> Go to Repo Settings</a>
</div>
</div>
</div>
</div>`;

$(modalTmp).bootstrapModal('show');

$(document, modalTmp).on('hidden.bs.modal', function(e) {
$('#exampleModalCenter').remove();
$(modalTmp).bootstrapModal('dispose');
});
};

var set_extended_time_html = function(extendedDuration) {
extendedDuration = extendedDuration.set({hour: 0, minute: 0, second: 0, millisecond: 0});
Expand Down Expand Up @@ -1271,8 +1183,7 @@ var do_actions = function(result) {
const _entry = {
enabled: true,
href: github_url,
text: (result['repo_type'] === 'private' ? '<i class="fas fa-lock mr-2"></i> ' +
gettext('Private Repo') : '<i class="fab fa-github mr-2"></i>' + gettext('View On Github')),
text: '<i class="fab fa-github mr-2"></i>' + gettext('View On Github'),
parent: 'github_actions',
title: gettext('View issue details and comments on Github')
};
Expand Down Expand Up @@ -1461,9 +1372,6 @@ var pull_bounty_from_api = function() {
projectModal(document.result.pk);
}

if (typeof promptPrivateInstructions !== 'undefined' && result.repo_type === 'private') {
repoInstructions();
}
return;
}
}
Expand Down Expand Up @@ -1531,13 +1439,6 @@ const process_activities = function(result, bounty_activities) {
}
return false;
}) : false;
const has_signed_nda = result.interested.length ?
result.interested.find(interest => {
if (interest.profile.handle === _activity.profile.handle && interest.signed_nda) {
return interest.signed_nda.doc;
}
return false;
}) : false;
const has_pending_interest = !!result.interested.find(interest =>
interest.profile.handle === _activity.profile.handle && interest.pending);
const has_interest = !!result.interested.find(interest =>
Expand Down Expand Up @@ -1588,7 +1489,6 @@ const process_activities = function(result, bounty_activities) {
age: timeDifference(now, new Date(_activity.created)),
activity_type: _activity.activity_type,
status: _activity.activity_type === 'work_started' ? 'started' : 'stopped',
signed_nda: has_signed_nda,
issue_message: issue_message,
uninterest_possible: uninterest_possible,
slash_possible: slash_possible,
Expand Down
87 changes: 19 additions & 68 deletions app/assets/v2/js/pages/bounty_details2.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,6 @@ var show_interest_modal = function() {

modals.on('show.bs.modal', function() {
modalBody.load(modalUrl, ()=> {
if (document.result['repo_type'] === 'private') {
document.result.unsigned_nda ? $('.nda-download-link').attr('href', document.result.unsigned_nda.doc) : $('#nda-upload').hide();
}

let actionPlanForm = $('#action_plan');
let issueMessage = $('#issue_message');

Expand All @@ -528,71 +524,26 @@ var show_interest_modal = function() {
return false;
}

const issueNDA = document.result['repo_type'] === 'private' ? $('#issueNDA')[0].files : undefined;

if (issueNDA && typeof issueNDA[0] !== 'undefined') {

const formData = new FormData();

formData.append('docs', issueNDA[0]);
formData.append('doc_type', 'signed_nda');

const ndaSend = {
url: '/api/v0.1/bountydocument',
method: 'POST',
data: formData,
processData: false,
dataType: 'json',
contentType: false
};

$.ajax(ndaSend).done(function(response) {
if (response.status == 200) {
_alert(response.message, 'info');
add_interest(document.result['pk'], {
issue_message: msg,
signed_nda: response.bounty_doc_id,
discord_username: $('#discord_username').length ? $('#discord_username').val() : null
}).then(success => {
if (success) {
$(self).attr('href', '/uninterested');
$(self).find('span').text(gettext('Stop Work'));
$(self).parent().attr('title', '<div class="tooltip-info tooltip-sm">' + gettext('Notify the funder that you will not be working on this project') + '</div>');
modals.bootstrapModal('hide');
}
}).catch((error) => {
if (error.responseJSON.error === 'You may only work on max of 3 issues at once.')
return;
throw error;
});
} else {
_alert(response.message, 'error');
add_interest(document.result['pk'], {
issue_message: msg,
discord_username: $('#discord_username').length ? $('#discord_username').val() : null
}).then(success => {
if (success) {
// $(self).attr('href', '/uninterested');
// $(self).find('span').text(gettext('Stop Work'));
// $(self).parent().attr('title', '<div class="tooltip-info tooltip-sm">' + gettext('Notify the funder that you will not be working on this project') + '</div>');
appBounty.fetchBounty();
modals.bootstrapModal('hide');

if (document.result.event) {
projectModal(document.result.pk);
}
}).fail(function(error) {
_alert(error, 'error');
});
} else {
add_interest(document.result['pk'], {
issue_message: msg,
discord_username: $('#discord_username').length ? $('#discord_username').val() : null
}).then(success => {
if (success) {
// $(self).attr('href', '/uninterested');
// $(self).find('span').text(gettext('Stop Work'));
// $(self).parent().attr('title', '<div class="tooltip-info tooltip-sm">' + gettext('Notify the funder that you will not be working on this project') + '</div>');
appBounty.fetchBounty();
modals.bootstrapModal('hide');

if (document.result.event) {
projectModal(document.result.pk);
}
}
}).catch((error) => {
if (error.responseJSON.error === 'You may only work on max of 3 issues at once.')
return;
throw error;
});
}
}
}).catch((error) => {
if (error.responseJSON.error === 'You may only work on max of 3 issues at once.')
return;
throw error;
});

});

Expand Down
49 changes: 5 additions & 44 deletions app/assets/v2/js/pages/create_bounty/ETH.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,38 +286,6 @@ const ethCreateBounty = data => {
}
};

const uploadNDA = function() {
const formData = new FormData();

formData.append('docs', $('#issueNDA')[0].files[0]);
formData.append('doc_type', 'unsigned_nda');
const settings = {
url: '/api/v0.1/bountydocument',
method: 'POST',
processData: false,
dataType: 'json',
contentType: false,
data: formData
};

$.ajax(settings).done(function(response) {
if (response.status == 200) {
_alert(response.message, 'info');
ipfsBounty.payload.unsigned_nda = response.bounty_doc_id;
if (data.featuredBounty) payFeaturedBounty();
else do_bounty();
} else {
_alert('Unable to upload NDA. ', 'error');
unloading_button($('.js-submit'));
console.log('NDA error:', response.message);
}
}).fail(function(error) {
_alert('Unable to upload NDA. ', 'error');
unloading_button($('.js-submit'));
console.log('NDA error:', error);
});
};

const payFeaturedBounty = function() {
indicateMetamaskPopup();
web3.eth.sendTransaction({
Expand Down Expand Up @@ -347,18 +315,11 @@ const ethCreateBounty = data => {
};

function processBounty() {
if (
$("input[type='radio'][name='repo_type']:checked").val() == 'private' &&
$('#issueNDA')[0].files[0]
) {
uploadNDA();
} else {
handleTokenAuth().then(isAuthedToken => {
if (isAuthedToken) {
data.featuredBounty ? payFeaturedBounty() : do_bounty();
}
});
}
handleTokenAuth().then(isAuthedToken => {
if (isAuthedToken) {
data.featuredBounty ? payFeaturedBounty() : do_bounty();
}
});
}

if (check_balance_and_alert_user_if_not_enough(tokenAddress, amountNoDecimal)) {
Expand Down
1 change: 0 additions & 1 deletion app/assets/v2/js/pages/create_bounty/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ createBounty = data => {
'fee_amount': fee_amount,
'fee_tx_id': fee_tx_id,
'coupon_code': coupon_code,
'unsigned_nda': '', // ETC-TODO
'privacy_preferences': JSON.stringify(privacy_preferences),
'attached_job_description': hiring.jobDescription,
'eventTag': metadata.eventTag,
Expand Down
Loading