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

re-invite user #4472

Closed
wants to merge 5 commits into from
Closed
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
60 changes: 35 additions & 25 deletions app/assets/v2/css/bounty.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,41 @@ body {
padding-top: 3em;
}

.invite-user .avatar {
width: 5.5rem;
height: 5.5rem;
}

.quote-container {
width: 55%;
z-index: 2;
}

.quote-container img {
top: 3rem;
left: -2rem;
position: relative;
}

.quote-container .quote_text {
font-size: 1.1rem;
color: #4A4A4A;
}

.quote-container .quote_author {
color: #4A4A4A;
font-size: 1rem;
font-style: italic;
}

.bounty_details .avatar {
width: 50px;
height: 50px;
margin: 0px auto;
border-radius: 50px;
margin-top: 0px;
}

.bounty_details .avatar.Azure-Samples {
border-radius: 0px;
}
Expand Down Expand Up @@ -478,7 +506,10 @@ a.btn {
font-weight: 600;
}

.username, .contributor-position, .in-progress, .current_status {
.contributor-position,
.username,
.current_status,
.in-progress {
color: #0D0764;
}

Expand All @@ -487,11 +518,13 @@ a.btn {
font-size: 10px;
line-height: 11px;
}

.completed-bounties {
color: #05B66A;
}

.abandoned-bounties, .removed-bounties {
.abandoned-bounties,
.removed-bounties {
color: #F5A623;
}

Expand Down Expand Up @@ -682,7 +715,6 @@ a.btn {
width: auto;
}


.btn-interested,
.btn-extend,
.btn-cancel {
Expand Down Expand Up @@ -727,28 +759,6 @@ a.btn {
text-align: center;
}

.bounty_details .quote-container,
.grant_waiting .quote-container {
width: 55%;
margin: 4rem auto;
font-weight: 700;
z-index: 2;
}

.bounty_details .quote_text,
.grant_waiting .quote_text {
margin-top: 50px;
font-size: 1.1rem;
color: #4A4A4A;
}

.bounty_details .quote_author,
.grant_waiting .quote_author {
color: #4A4A4A;
margin: 1rem auto;
font-size: 1rem;
}

.ethereum-issue {
width:100%;
color: #ffffff;
Expand Down
63 changes: 62 additions & 1 deletion app/assets/v2/js/pages/bounty_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,9 @@ var showWarningMessage = function(txid) {

$('.left-rails').hide();
$('#bounty_details').hide();
$('#bounty_detail').hide();

waitingStateActive();
show_invite_users();
};

// refresh page if metamask changes
Expand Down Expand Up @@ -1564,6 +1564,67 @@ const is_bounty_expired = function(bounty) {
return now.getTime() >= expires_date.getTime();
};

/**
* Checks sessionStorage to toggle to show the quote
* container vs showing the list of fulfilled users to be
* invite.
*/
const show_invite_users = () => {

if (sessionStorage['fulfillers']) {
const users = sessionStorage['fulfillers'].split(',');

if (users.length == 1) {

let user = users[0];
const title = `Work with <b>${user}</b> again on your next bounty ?`;
const invite = `
<div class="invite-user">
<img class="avatar" src="/dynamic/avatar/${users}" />
<p class="mt-4">
<a target="_blank" class="btn btn-gc-blue shadow-none py-2 px-4" href="/users?invite=${user}">
Yes, invite to one of my bounties
</a>
</p>
</div>`;

$('#invite-header').html(title);
$('#invite-users').html(invite);
} else {

let invites = [];
const title = 'Work with these contributors again on your next bounty?';

users.forEach(user => {
const invite = `
<div class="invite-user mx-3">
<img class="avatar" src="/dynamic/avatar/${user}"/>
<p class="my-2">
<a target="_blank" class="font-subheader blue" href="/profile/${user}">
${user}
</a>
</p>
<a target="_blank" class="btn btn-gc-blue shadow-none px-4 font-body font-weight-semibold" href="/users?invite=${user}">
Invite
</a>
</div>`;

invites.push(invite);
});

$('#invite-users').addClass('d-flex justify-content-center');
$('#invite-header').html(title);
$('#invite-users').html(invites);
}
delete sessionStorage['fulfillers'];
$('.invite-user-container').removeClass('hidden');
$('.quote-container').addClass('hidden');
} else {
$('.invite-user-container').addClass('hidden');
$('.quote-container').removeClass('hidden');
}
};

var main = function() {
const moderatorAndAdminActions = $('#moderator-admin-actions');
const scrollHeight = 150;
Expand Down
14 changes: 14 additions & 0 deletions app/assets/v2/js/pages/bulk_payout.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ $(document).ready(function($) {

$('#acceptBounty').on('click', function(e) {
e.preventDefault();
getFulfillers();
update_registry();

if (!$('#terms').is(':checked')) {
Expand Down Expand Up @@ -346,6 +347,19 @@ var update_registry = function(coinbase) {
document.transactions = transactions;
};

/**
* stores fulfillers in sessionStorage on
* triggering advanced payout
*/
const getFulfillers = () => {
let fulfillers = [];
const users = $('.new-user option');

for (let i = 0; i < users.length; i++) {
fulfillers.push($('.new-user option')[i].innerHTML);
}
sessionStorage['fulfillers'] = fulfillers;
};

$(document).on('click', '.user-fulfiller', function(event) {
let elem = $('.username-search');
Expand Down
24 changes: 11 additions & 13 deletions app/assets/v2/js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,18 @@ var waitingStateActive = function() {
};

const notify_funder = (network, std_bounties_id, data) => {
var request_url = '/actions/bounty/' + network + '/' + std_bounties_id + '/notify/funder_payout_reminder/';
var request_url = '/actions/bounty/' + network + '/' + std_bounties_id + '/notify/funder_payout_reminder/';

showBusyOverlay();
$.post(request_url, data).then(result => {
hideBusyOverlay();

_alert({message: gettext('Sent payout reminder')}, 'success');
$('#notifyFunder a').addClass('disabled');
return true;
}).fail(result => {
hideBusyOverlay();

_alert({ message: gettext('got an error. please try again, or contact [email protected]') }, 'error');
});
showBusyOverlay();
$.post(request_url, data).then(() => {
hideBusyOverlay();
_alert({message: gettext('Sent payout reminder')}, 'success');
$('#notifyFunder a').addClass('disabled');
return true;
}).fail(() => {
hideBusyOverlay();
_alert({ message: gettext('got an error. please try again, or contact [email protected]') }, 'error');
});
};

/** Add the current profile to the interested profiles list. */
Expand Down
31 changes: 29 additions & 2 deletions app/assets/v2/js/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ Vue.mixin({
console.log(user);
vm.userSelected = user;
vm.showModal = true;

},
sendInvite: function(bounty, user) {
let vm = this;
Expand Down Expand Up @@ -129,6 +128,21 @@ Vue.mixin({
},
closeModal() {
this.$refs['user-modal'].closeModal();
},
inviteOnMount: function() {
let vm = this;
let contributor = getURLParams('invite');

if (contributor) {
let api = `/api/v0.1/users_fetch/?search=${contributor}`;
let getUsers = fetchData (api, 'GET');

$.when(getUsers).then(function(response) {
if (response && response.data) {
vm.reinviteUser = response.data[0];
}
});
}
}
}

Expand Down Expand Up @@ -156,10 +170,12 @@ if (document.getElementById('gc-users-directory')) {
skills: document.keywords,
selectedSkills: [],
noResults: false,
isLoading: true
isLoading: true,
reinviteUser: ''
},
mounted() {
this.fetchUsers();
this.inviteOnMount();
this.$watch('params', function(newVal, oldVal) {
this.searchUsers();
}, {
Expand All @@ -182,3 +198,14 @@ if (document.getElementById('gc-users-directory')) {
});
}

if (getURLParams('invite')) {
let timer = setInterval(function() {
if ($('#reinvite-user').length) {
$('#reinvite-user').trigger('click');
setTimeout(function() {
$('#reinvite-user').trigger('click');
}, 200);
clearInterval(timer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this you can user the vm methods this.openBounties(reinviteUser), you don't need to go to trigger from the view.

}
}, 500);
}
13 changes: 2 additions & 11 deletions app/dashboard/templates/bounty/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
</div>

<div class="col-12 offset-md-1 col-md-10 offset-lg-1 col-lg-8 body">
{% include 'shared/bounty_waiting_state.html' with can_close=True %}
{% include 'shared/waiting_state.html' %}

<div class="row nonefound" style="display:none;">
<img src="{% static "v2/images/shrug_bot.png" %}">
<h3>{% trans "No funded issue found." %}</h3>
Expand All @@ -40,16 +41,6 @@ <h6>{% trans "Be the OSS Funding you wish to see in the world." %}</h6>
<p id='submitsolicitation'>{% url 'new_funding' as new_fundingurl %}{% blocktrans %} Looking to fund some work? You can submit a new Funded Issue <a href="{{ new_fundingurl }}">here</a>.{% endblocktrans %}</p>
</div>

<div class="row ml-2 mr-2 pl-4 pr-4 waiting_room_entertainment" style="display: none;">
{% include 'shared/rain.html' with class="color" %}
<div class="quote-container">
<img src="{% static "v2/images/quotes.png" %}" style="float: left; max-width: 22px;" />
<div class="quote_text"></div>
<div class="quote_author"></div>
<input id="quoteRefresh" class="button button--primary" name="refresh" type='submit' onclick='javascript:waitingRoomEntertainment()' value="Refresh Quote" >
</div>
</div>

<div class="col-12" id="moderator-admin-actions"></div>
<div class="col-12" id="bounty_details">
<div class="row font-body">
Expand Down
Loading