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

Fixes admin priviledge to stop work in activity #2167

Merged
merged 8 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 2 additions & 2 deletions app/avatar/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class AvatarAdmin(GeneralAdmin):

ordering = ['-id']
fields = [
'config', 'use_github_avatar', 'svg_asset', 'custom_png_asset', 'github_svg_asset',
'png_asset', 'created_on', 'modified_on'
'config', 'use_github_avatar', 'svg_asset', 'custom_png_asset', 'github_svg_asset', 'png_asset', 'created_on',
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

'modified_on'
]
readonly_fields = ['svg_asset', 'custom_png_asset', 'github_svg_asset', 'png_asset', 'created_on', 'modified_on']
inlines = [ProfileInline, ]
Expand Down
20 changes: 4 additions & 16 deletions app/avatar/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,17 @@ class Meta:
config = JSONField(default=dict, help_text=_('The JSON configuration of the custom avatar.'), )
# Github Avatar
github_svg = models.FileField(
upload_to=get_upload_filename,
null=True,
blank=True,
help_text=_('The Github avatar SVG.')
upload_to=get_upload_filename, null=True, blank=True, help_text=_('The Github avatar SVG.')
Copy link
Contributor

Choose a reason for hiding this comment

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

😅

)
png = models.ImageField(
upload_to=get_upload_filename,
null=True,
blank=True,
help_text=_('The Github avatar PNG.'),
upload_to=get_upload_filename, null=True, blank=True, help_text=_('The Github avatar PNG.'),
)
# Custom Avatar
custom_avatar_png = models.ImageField(
upload_to=get_upload_filename,
null=True,
blank=True,
help_text=_('The custom avatar PNG.'),
upload_to=get_upload_filename, null=True, blank=True, help_text=_('The custom avatar PNG.'),
)
svg = models.FileField(
upload_to=get_upload_filename,
null=True,
blank=True,
help_text=_('The custom avatar SVG.'),
upload_to=get_upload_filename, null=True, blank=True, help_text=_('The custom avatar SVG.'),
)

use_github_avatar = models.BooleanField(default=True)
Expand Down
67 changes: 37 additions & 30 deletions app/avatar/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

logger = logging.getLogger(__name__)


def get_avatar_context():
return {
'defaultSkinTone': 'AE7242',
Expand Down Expand Up @@ -66,36 +67,42 @@ def get_avatar_context():
'name': 'Ears',
'title': 'Pick ears shape',
'options': ('0', '1', '2', '3')
}, {
'name': 'Clothing',
'title': 'Pick your clothing',
'options': ('cardigan', 'hoodie', 'knitsweater', 'plaid', 'shirt', 'shirtsweater')
}, {
'name': 'Hair Style',
'title': 'Pick a hairstyle',
'options': (['None', '0'], ['None', '1'], ['None', '2'], ['None', '3'], ['None', '4'], ['5', 'None'],
['6-back', '6-front'], ['7-back', '7-front'], ['8-back', '8-front'])
}, {
'name': 'Facial Hair',
'title': 'Pick a facial hair style',
'options': (
'Mustache-0', 'Mustache-1', 'Mustache-2', 'Mustache-3', 'Beard-0', 'Beard-1', 'Beard-2', 'Beard-3'
)
}, {
'name': 'Accessories',
'title': 'Pick your accessories',
'options': (['Glasses-0'], ['Glasses-1'], ['Glasses-2'], ['Glasses-3'], ['Glasses-4'], [
'HatShort-backwardscap'
], ['HatShort-ballcap'], ['HatShort-headphones'], ['HatShort-shortbeanie'], ['HatShort-tallbeanie'],
['Earring-0'], ['Earring-1'], ['EarringBack-2', 'Earring-2'], ['Earring-3'], ['Earring-4'])
}, {
'name': 'Background',
'title': 'Pick a background color',
'options': (
'25E899', '9AB730', '00A55E', '3FCDFF', '3E00FF', '8E2ABE', 'D0021B', 'F9006C', 'FFCE08', 'F8E71C',
'15003E', 'FFFFFF'
)
}],
},
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you revert the indent change here?

'name': 'Clothing',
'title': 'Pick your clothing',
'options': ('cardigan', 'hoodie', 'knitsweater', 'plaid', 'shirt', 'shirtsweater')
},
{
'name': 'Hair Style',
'title': 'Pick a hairstyle',
'options': (['None', '0'], ['None', '1'], ['None', '2'], ['None', '3'], ['None', '4'],
['5', 'None'], ['6-back', '6-front'], ['7-back', '7-front'], ['8-back', '8-front'])
},
{
'name': 'Facial Hair',
'title': 'Pick a facial hair style',
'options': (
'Mustache-0', 'Mustache-1', 'Mustache-2', 'Mustache-3', 'Beard-0', 'Beard-1', 'Beard-2',
'Beard-3'
)
},
{
'name': 'Accessories',
'title': 'Pick your accessories',
'options': (['Glasses-0'], ['Glasses-1'], ['Glasses-2'], ['Glasses-3'], ['Glasses-4'],
['HatShort-backwardscap'], ['HatShort-ballcap'], ['HatShort-headphones'],
['HatShort-shortbeanie'], ['HatShort-tallbeanie'], ['Earring-0'], ['Earring-1'],
['EarringBack-2', 'Earring-2'], ['Earring-3'], ['Earring-4'])
},
{
'name': 'Background',
'title': 'Pick a background color',
'options': (
'25E899', '9AB730', '00A55E', '3FCDFF', '3E00FF', '8E2ABE', 'D0021B', 'F9006C', 'FFCE08',
'F8E71C', '15003E', 'FFFFFF'
)
}],
}


Expand Down
65 changes: 37 additions & 28 deletions app/dashboard/templates/bounty/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,52 +267,45 @@ <h5 class="bounty-heading">{% trans "Funder" %}</h5>
</div>
[[/if]]
</div>
[[else activity_type == 'start_work' || activity_type == 'worker_approved' || activity_type == 'bounty_abandonment_warning' ]]
[[else activity_type == 'start_work' || activity_type == 'worker_approved' || activity_type == 'bounty_abandonment_warning' || activity_type == 'worker_applied']]
<div class="col-12 col-md-7 started-status-column">
<div class="activity-status">
[[:text]]
</div>
[[if uninterest_possible]]
[[if can_approve_worker ]]
<div class="stop-work">
<span title="<div class='tooltip-info tooltip-sm'>Reject worker</div>">
<a class="button button--primary" href="[[:reject_worker_url]]">
<span class="font-smaller-4">{% trans "Reject worker" %}</span>
</a>
</span>
</div>
<div class="stop-work">
<span title="<div class='tooltip-info tooltip-sm'>Approve worker</div>">
<a class="button button--primary" href="[[:approve_worker_url]]">
<span class="font-smaller-4">{% trans "Approve worker" %}</span>
</a>
</span>
</div>
[[else uninterest_possible]]
<div class="stop-work">
<span title="<div class='tooltip-info tooltip-sm'>Remove this user's started work on the bounty</div>">
<a id="remove-[[:name]]" class="button button--primary" role="button" href="remove-handle">
<span class="font-smaller-4">Stop work</span>
<span class="font-smaller-4">{% trans "Stop work" %}</span>
</a>
</span>
</div>
[[if slash_possible]]
<div class="stop-work">
<span title="<div class='tooltip-info tooltip-sm'>Remove this user's started work on the bounty and ding rep</div>">
<a id="remove-slash-[[:name]]" class="button button--primary admin-only" role="button" href="remove-handle">
<span class="font-smaller-4">Stop work + Ding Rep</span>
<span class="font-smaller-4">{% trans "Stop work + Ding Rep" %}</span>
</a>
</span>
</div>
[[/if]]
[[/if]]
</div>
[[else activity_type == 'worker_applied']]
<div class="col-12 col-md-7 started-status-column">
<div class="activity-status">
[[:text]]
</div>
[[if can_approve_worker ]]
<div class="stop-work">
<span title="<div class='tooltip-info tooltip-sm'>Reject worker</div>">
<a class="button button--primary" href="[[:reject_worker_url]]">
<span class="font-smaller-4">Reject worker</span>
</a>
</span>
</div>
<div class="stop-work">
<span title="<div class='tooltip-info tooltip-sm'>Approve worker</div>">
<a class="button button--primary" href="[[:approve_worker_url]]">
<span class="font-smaller-4">Approve worker</span>
</a>
</span>
</div>
[[/if]]
</div>
[[else activity_type == 'worker_approved' ]]
<div class="col-12 col-md-7 started-status-column">
<div class="activity-status">
Expand All @@ -334,13 +327,29 @@ <h5 class="bounty-heading">{% trans "Funder" %}</h5>
</div>
</div>
[[else activity_type == 'work_submitted']]
<div class="col-12 col-md-7">
<div class="col-12 col-md-7 started-status-column">
<div class="activity-status">
[[:text]]
[[if fulfiller_github_url]]
<a target="_blank" href="[[:fulfiller_github_url]]">[View Work]</a>
<a target="_blank" href="[[:fulfiller_github_url]]">[{% trans "View Work" %}]</a>
[[/if]]
</div>
[[if slash_possible]]
<div class="stop-work">
<span title="<div class='tooltip-info tooltip-sm'>Remove this user's started work on the bounty</div>">
<a id="remove-[[:name]]" class="button button--primary" role="button" href="remove-handle">
<span class="font-smaller-4">{% trans "Stop work" %}</span>
</a>
</span>
</div>
<div class="stop-work">
<span title="<div class='tooltip-info tooltip-sm'>Remove this user's started work on the bounty and ding rep</div>">
<a id="remove-slash-[[:name]]" class="button button--primary admin-only" role="button" href="remove-handle">
<span class="font-smaller-4">{% trans "Stop work + Ding Rep" %}</span>
</a>
</span>
</div>
[[/if]]
</div>
[[else activity_type == 'increased_bounty']]
<div class="col-12 col-md-7">
Expand Down
4 changes: 1 addition & 3 deletions app/dataviz/d3_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ def viz_chord(request, key='bounties_paid'):
if request.GET.get('data'):
rows = [['creditor', 'debtor', 'amount', 'risk']]
network = 'mainnet'
for bounty in Bounty.objects.current().filter(
network=network, web3_type='bounties_network', idx_status='done'
):
for bounty in Bounty.objects.current().filter(network=network, web3_type='bounties_network', idx_status='done'):
weight = bounty.value_in_usdt_then
if weight:
for fulfillment in bounty.fulfillments.filter(accepted=True):
Expand Down
49 changes: 25 additions & 24 deletions app/dataviz/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,30 +270,31 @@ def funnel(request):
'title': 'web => bounties_posted => bounties_fulfilled',
'keys': ['sessions', 'bounties_alltime', 'bounties_fulfilled', ],
'data': []
}, {
'title': 'web => bounties_posted => bounties_fulfilled (detail)',
'keys': [
'sessions', 'bounties_alltime', 'bounties_started_total', 'bounties_submitted_total', 'bounties_done_total',
'bounties_expired_total', 'bounties_cancelled_total',
],
'data': []
}, {
'title': 'web session => email_subscribers',
'keys': ['sessions', 'email_subscribers', ],
'data': []
}, {
'title': 'web session => slack',
'keys': ['sessions', 'slack_users', ],
'data': []
}, {
'title': 'web session => create dev grant',
'keys': ['sessions', 'dev_grant', ],
'data': []
}, {
'title': 'email funnel',
'keys': ['email_processed', 'email_open', 'email_click', ],
'data': []
}, ]
},
{
'title': 'web => bounties_posted => bounties_fulfilled (detail)',
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you revert the indent change here?

'keys': [
'sessions', 'bounties_alltime', 'bounties_started_total', 'bounties_submitted_total',
'bounties_done_total', 'bounties_expired_total', 'bounties_cancelled_total',
],
'data': []
}, {
'title': 'web session => email_subscribers',
'keys': ['sessions', 'email_subscribers', ],
'data': []
}, {
'title': 'web session => slack',
'keys': ['sessions', 'slack_users', ],
'data': []
}, {
'title': 'web session => create dev grant',
'keys': ['sessions', 'dev_grant', ],
'data': []
}, {
'title': 'email funnel',
'keys': ['email_processed', 'email_open', 'email_click', ],
'data': []
}, ]

for funnel in range(0, len(funnels)):
keys = funnels[funnel]['keys']
Expand Down
1 change: 0 additions & 1 deletion app/marketing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,3 @@ class EmailSupressionList(SuperModel):

def __str__(self):
return f"{self.email}"