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

Issue Explorer Check in tools for Admin (Vivek) #1446

Merged
merged 9 commits into from
Jun 13, 2018
Merged

Conversation

owocki
Copy link
Contributor

@owocki owocki commented Jun 12, 2018

Description

Issue Explorer Check in tools for Admin (Vivek)

Per my convo with Vivek on our checkin today, we need a better way to make the issue explorer checkin scale. This PR adds five buttons to each bounty for admins only

  • suspends auto approval (approval required bounties only)
  • hide bounty -- hides/removes it from our system
  • toggle remarket ready -- marks the bounty as priority to be promoted
  • contact funder -- prompts user for some text and then sends an email on their behalf containing that text
  • snooze gitcoinbot -- snoozes gitcoinbot

screen shot 2018-06-12 at 4 04 18 pm

screen shot 2018-06-12 at 4 04 02 pm

Checklist
  • linter status: 100% pass
  • changes don't break existing behavior
  • commit message follows commit guidelines
Affected core subsystem(s)

bounties, admin

Testing

tested each function

Refers/Fixes

Self, convo I had with Vivek this am

@ghost ghost assigned owocki Jun 12, 2018
@ghost ghost added the in progress label Jun 12, 2018
@@ -655,6 +670,69 @@ var do_actions = function(result) {

actions.push(_entry);
}
if (show_suspend_auto_approval) {
var url = result['url'] + '?suspend_auto_approval=1';

Choose a reason for hiding this comment

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

'url' used outside of binding context. (block-scoped-var)

if (show_suspend_auto_approval) {
var url = result['url'] + '?suspend_auto_approval=1';

var _entry = {

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)
'_entry' is already defined. (no-redeclare)


var _entry = {
enabled: true,
href: url,

Choose a reason for hiding this comment

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

'url' used outside of binding context. (block-scoped-var)

buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)

}

if (show_admin_override_and_hide) {
var url = result['url'] + '?admin_override_and_hide=1';

Choose a reason for hiding this comment

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

'url' used outside of binding context. (block-scoped-var)
'url' is already defined. (no-redeclare)

@@ -477,6 +477,8 @@ def create_new_bounty(old_bounties, bounty_payload, bounty_details, bounty_id):
last_comment_date=latest_old_bounty.last_comment_date if latest_old_bounty else None,
snooze_warnings_for_days=latest_old_bounty.snooze_warnings_for_days if latest_old_bounty else 0,
admin_override_and_hide=latest_old_bounty.admin_override_and_hide if latest_old_bounty else 0,
admin_override_suspend_auto_approval=latest_old_bounty.admin_override_suspend_auto_approval if latest_old_bounty else 0,

Choose a reason for hiding this comment

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

E501 line too long (136 > 120 characters)

@@ -195,6 +195,8 @@ class Bounty(SuperModel):
value_true = models.DecimalField(default=0, decimal_places=2, max_digits=50, blank=True, null=True)
privacy_preferences = JSONField(default={}, blank=True)
admin_override_and_hide = models.BooleanField(default=False, help_text=_('Admin override to hide the bounty from the system'))
admin_override_suspend_auto_approval = models.BooleanField(default=False, help_text=_('Admin override to suspend work auto approvals'))

Choose a reason for hiding this comment

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

E501 line too long (139 > 120 characters)

@@ -195,6 +195,8 @@ class Bounty(SuperModel):
value_true = models.DecimalField(default=0, decimal_places=2, max_digits=50, blank=True, null=True)
privacy_preferences = JSONField(default={}, blank=True)
admin_override_and_hide = models.BooleanField(default=False, help_text=_('Admin override to hide the bounty from the system'))
admin_override_suspend_auto_approval = models.BooleanField(default=False, help_text=_('Admin override to suspend work auto approvals'))
admin_mark_as_remarket_ready = models.BooleanField(default=False, help_text=_('Admin override to mark as remarketing ready'))

Choose a reason for hiding this comment

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

E501 line too long (129 > 120 characters)

helper_handle_suspend_auto_approval(request, bounty)
helper_handle_mark_as_remarket_ready(request, bounty)
helper_handle_admin_contact_funder(request, bounty)

Choose a reason for hiding this comment

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

W293 blank line contains whitespace

start_time = timezone.now() - timezone.timedelta(hours=(threshold+1))
end_time = timezone.now() - timezone.timedelta(hours=(threshold))
interests = Interest.objects.filter(pending=True, created__gt=start_time, created__lt=end_time)
print(f"{interests.count()} {action_str}")
for interest in interests:
bounty = interest.bounties.first() # TODO is this right? is this how i get the bounty?
bounty = interest.bounties.first()

Choose a reason for hiding this comment

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

W291 trailing whitespace

@codecov
Copy link

codecov bot commented Jun 12, 2018

Codecov Report

Merging #1446 into master will decrease coverage by 0.14%.
The diff coverage is 15.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1446      +/-   ##
==========================================
- Coverage   30.28%   30.14%   -0.15%     
==========================================
  Files         125      125              
  Lines        9096     9166      +70     
  Branches     1166     1178      +12     
==========================================
+ Hits         2755     2763       +8     
- Misses       6232     6294      +62     
  Partials      109      109
Impacted Files Coverage Δ
app/dashboard/helpers.py 26.98% <ø> (ø) ⬆️
.../management/commands/pending_start_work_actions.py 0% <0%> (ø) ⬆️
...arketing/management/commands/new_bounties_email.py 0% <0%> (ø) ⬆️
app/dashboard/models.py 56.52% <100%> (+0.08%) ⬆️
app/dashboard/views.py 15.2% <11.62%> (-0.41%) ⬇️
app/retail/emails.py 21.14% <16.66%> (-0.1%) ⬇️
...marketing/management/commands/remarket_bounties.py 50% <28.57%> (ø)
app/marketing/mails.py 11.97% <8.33%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13720b3...4b89623. Read the comment docs.

buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)

buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)

buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)

if (show_admin_toggle_remarket) {
var url = result['url'] + '?admin_toggle_as_remarket_ready=1';

var _entry = {

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)
'_entry' is already defined. (no-redeclare)

buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)

}

if (show_admin_snooze) {
var url = '';

Choose a reason for hiding this comment

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

'url' used outside of binding context. (block-scoped-var)
'url' is already defined. (no-redeclare)

if (show_admin_snooze) {
var url = '';

var _entry = {

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)
'_entry' is already defined. (no-redeclare)


var _entry = {
enabled: true,
href: url,

Choose a reason for hiding this comment

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

'url' used outside of binding context. (block-scoped-var)

buttonclass: 'admin-only snooze_gitcoin_bot'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)

buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)

if (show_admin_toggle_remarket) {
var url = result['url'] + '?admin_toggle_as_remarket_ready=1';

var _entry = {

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)
'_entry' is already defined. (no-redeclare)

buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)


var _entry = {
enabled: true,
href: url,

Choose a reason for hiding this comment

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

'url' used outside of binding context. (block-scoped-var)

@ghost ghost assigned mbeacom Jun 13, 2018
buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)

if (show_admin_toggle_remarket) {
var url = result['url'] + '?admin_toggle_as_remarket_ready=1';

var _entry = {

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)
'_entry' is already defined. (no-redeclare)

buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)


var _entry = {
enabled: true,
href: url,

Choose a reason for hiding this comment

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

'url' used outside of binding context. (block-scoped-var)

buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)

if (show_admin_toggle_remarket) {
var url = result['url'] + '?admin_toggle_as_remarket_ready=1';

var _entry = {

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)
'_entry' is already defined. (no-redeclare)

buttonclass: 'admin-only'
};

actions.push(_entry);

Choose a reason for hiding this comment

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

'_entry' used outside of binding context. (block-scoped-var)


var _entry = {
enabled: true,
href: url,

Choose a reason for hiding this comment

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

'url' used outside of binding context. (block-scoped-var)

Copy link
Contributor

@mbeacom mbeacom left a comment

Choose a reason for hiding this comment

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

Generally, lgtm. I pushed a commit to consolidate the migration files and resolve the pytest failure. I'm not sure if we want to address the eslint warnings that stickler is commenting about, but 🚢

@owocki owocki merged commit e7088a8 into master Jun 13, 2018
@ghost ghost removed the in progress label Jun 13, 2018
@mbeacom mbeacom deleted the kevin/staff_actions branch June 13, 2018 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants