diff --git a/app/assets/v2/js/pages/new_bounty.js b/app/assets/v2/js/pages/new_bounty.js index f856aa5b397..8ab4eea4580 100644 --- a/app/assets/v2/js/pages/new_bounty.js +++ b/app/assets/v2/js/pages/new_bounty.js @@ -5,6 +5,9 @@ load_tokens(); var localStorage = window.localStorage ? window.localStorage : {}; const quickstartURL = document.location.origin + '/bounty/quickstart'; + +let params = (new URL(document.location)).searchParams; + const FEE_PERCENTAGE = document.FEE_PERCENTAGE / 100.0; var new_bounty = { @@ -40,9 +43,15 @@ $('.select2-tag__choice').on('click', function() { }); const getSuggestions = () => { + let queryParams = {}; + + queryParams.keywords = $('#keywords').val(); + queryParams.invite = params.get('invite') || ''; + + let searchParams = new URLSearchParams(queryParams); const settings = { - url: `/api/v0.1/get_suggested_contributors?keywords=${$('#keywords').val()}`, + url: `/api/v0.1/get_suggested_contributors?${searchParams}`, method: 'GET', processData: false, dataType: 'json', @@ -53,7 +62,8 @@ const getSuggestions = () => { let groups = { 'contributors': 'Recently worked with you', 'recommended_developers': 'Recommended based on skills', - 'verified_developers': 'Verified contributors' + 'verified_developers': 'Verified contributors', + 'invites': 'Invites' }; let options = Object.entries(response).map(([ text, children ]) => ( @@ -68,8 +78,12 @@ const getSuggestions = () => { } obj.children.forEach((children, childIndex) => { - children.text = children.fulfiller_github_username || children.user__profile__handle; + children.text = children.fulfiller_github_username || children.user__profile__handle || children.handle; children.id = generalIndex; + if (obj.text == 'Invites') { + children.selected = true; + $('#reserve-section').collapse('show'); + } generalIndex++; }); return obj; @@ -275,7 +289,22 @@ $(function() { setUsdAmount(); } - userSearch('#reservedFor', false); + if (params.get('reserved')) { + $('#reserve-section').collapse('show'); + } + + userSearch( + '#reservedFor', + // show address + false, + // theme + '', + // initial data + params.get('reserved') ? [params.get('reserved')] : [], + // allowClear + true + ); + }); @@ -828,7 +857,6 @@ const populateBountyTotal = () => { }; let isPrivateRepo = false; -let params = (new URL(document.location)).searchParams; const toggleCtaPlan = (value) => { if (value === 'private') { diff --git a/app/assets/v2/js/users.js b/app/assets/v2/js/users.js index 8b1d133137a..658c72c9ad9 100644 --- a/app/assets/v2/js/users.js +++ b/app/assets/v2/js/users.js @@ -87,8 +87,8 @@ Vue.mixin({ let getBounties = fetchData(apiUrlBounties, 'GET'); $.when(getBounties).then((response) => { + vm.isFunder = response.is_funder; vm.funderBounties = response.data; - console.log(vm.funderBounties); }); }, @@ -158,6 +158,7 @@ if (document.getElementById('gc-users-directory')) { bottom: false, params: {}, funderBounties: [], + isFunder: false, bountySelected: null, userSelected: [], showModal: false, diff --git a/app/dashboard/templates/dashboard/users.html b/app/dashboard/templates/dashboard/users.html index 666275c37fc..cd142c3849c 100644 --- a/app/dashboard/templates/dashboard/users.html +++ b/app/dashboard/templates/dashboard/users.html @@ -125,6 +125,12 @@