Skip to content

Commit

Permalink
purge: RefundFee flow
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc committed Apr 13, 2020
1 parent 3d0e575 commit 4102290
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 664 deletions.
6 changes: 0 additions & 6 deletions app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@
path('issue/payout', dashboard.views.payout_bounty, name='payout_bounty'),
path('issue/increase', dashboard.views.increase_bounty, name='increase_bounty'),
path('issue/cancel', dashboard.views.cancel_bounty, name='kill_bounty'),
path('issue/refund_request', dashboard.views.refund_request, name='refund_request'),
path('issue/cancel_reason', dashboard.views.cancel_reason, name='cancel_reason'),
path('modal/social_contribution', dashboard.views.social_contribution_modal, name='social_contribution_modal'),
path(
Expand Down Expand Up @@ -566,11 +565,6 @@
faucet.views.process_faucet_request,
name='process_faucet_request'
),
re_path(
r'^_administration/process_refund_request/(.*)$',
dashboard.views.process_refund_request,
name='process_refund_request'
),
re_path(
r'^_administration/email/start_work_approved$', retail.emails.start_work_approved, name='start_work_approved'
),
Expand Down
106 changes: 0 additions & 106 deletions app/assets/v2/js/pages/process_refund_request.js

This file was deleted.

39 changes: 0 additions & 39 deletions app/assets/v2/js/pages/refund_request.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/assets/v2/js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ var trigger_faucet_form_web3_hooks = function() {
$('#faucet_form').removeClass('hidden');
}
}
if ($('#admin_faucet_form').length || $('#admin_refund_form').length) {
if ($('#admin_faucet_form').length) {
if (typeof web3 == 'undefined') {
$('#no_metamask_error').css('display', 'block');
$('#faucet_form').addClass('hidden');
Expand Down
50 changes: 2 additions & 48 deletions app/dashboard/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
from .models import (
Activity, BlockedURLFilter, BlockedUser, Bounty, BountyEvent, BountyFulfillment, BountyInvites, BountySyncRequest,
CoinRedemption, CoinRedemptionRequest, Coupon, Earning, FeedbackEntry, HackathonEvent, HackathonProject,
HackathonRegistration, HackathonSponsor, Interest, LabsResearch, PortfolioItem, Profile, ProfileView,
RefundFeeRequest, SearchHistory, Sponsor, Tip, TipPayout, TokenApproval, Tool, ToolVote, TribeMember, UserAction,
UserVerificationModel,
HackathonRegistration, HackathonSponsor, Interest, LabsResearch, PortfolioItem, Profile, ProfileView, SearchHistory,
Sponsor, Tip, TipPayout, TokenApproval, Tool, ToolVote, TribeMember, UserAction, UserVerificationModel,
)


Expand Down Expand Up @@ -309,50 +308,6 @@ def coupon_link(self, instance):
return mark_safe(f"<a href={url}>{copy}</a>")


class RefundFeeRequestAdmin(admin.ModelAdmin):
"""Setup the RefundFeeRequest admin results display."""

raw_id_fields = ['bounty', 'profile']
ordering = ['-created_on']
list_display = ['pk', 'created_on', 'fulfilled', 'rejected', 'link', 'get_bounty_link', 'get_profile_handle',]
readonly_fields = ['pk', 'token', 'fee_amount', 'comment', 'address', 'txnId', 'link', 'get_bounty_link',]
search_fields = ['created_on', 'fulfilled', 'rejected', 'bounty', 'profile']

def get_bounty_link(self, obj):
bounty = getattr(obj, 'bounty', None)
url = bounty.url
return mark_safe(f"<a href={url}>{bounty}</a>")

def get_profile_handle(self, obj):
"""Get the profile handle."""
profile = getattr(obj, 'profile', None)
if profile and profile.handle:
return mark_safe(
f'<a href=/_administration/dashboard/profile/{profile.pk}/change/>{profile.handle}</a>'
)
if obj.github_username:
return obj.github_username
return 'N/A'

get_profile_handle.admin_order_field = 'handle'
get_profile_handle.short_description = 'Profile Handle'

def link(self, instance):
"""Handle refund fee request specific links.
Args:
instance (RefundFeeRequest): The refund request to build a link for.
Returns:
str: The HTML element for the refund request link.
"""
if instance.fulfilled or instance.rejected:
return 'n/a'
return mark_safe(f"<a href=/_administration/process_refund_request/{instance.pk}>process me</a>")
link.allow_tags = True


class HackathonSponsorAdmin(admin.ModelAdmin):
"""The admin object for the HackathonSponsor model."""

Expand Down Expand Up @@ -483,6 +438,5 @@ class TribeMemberAdmin(admin.ModelAdmin):
admin.site.register(FeedbackEntry, FeedbackAdmin)
admin.site.register(LabsResearch)
admin.site.register(UserVerificationModel, VerificationAdmin)
admin.site.register(RefundFeeRequest, RefundFeeRequestAdmin)
admin.site.register(Coupon, CouponAdmin)
admin.site.register(TribeMember, TribeMemberAdmin)
26 changes: 0 additions & 26 deletions app/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,32 +1399,6 @@ class BountySyncRequest(SuperModel):
processed = models.BooleanField()


class RefundFeeRequest(SuperModel):
"""Define the Refund Fee Request model."""
profile = models.ForeignKey(
'dashboard.Profile',
null=True,
on_delete=models.SET_NULL,
related_name='refund_requests',
)
bounty = models.ForeignKey(
'dashboard.Bounty',
on_delete=models.CASCADE
)
fulfilled = models.BooleanField(default=False)
rejected = models.BooleanField(default=False)
comment = models.TextField(max_length=500, blank=True)
comment_admin = models.TextField(max_length=500, blank=True)
fee_amount = models.FloatField()
token = models.CharField(max_length=10)
address = models.CharField(max_length=255)
txnId = models.CharField(max_length=255, blank=True)

def __str__(self):
"""Return the string representation of RefundFeeRequest."""
return f"bounty: {self.bounty}, fee: {self.fee_amount}, token: {self.token}. Time: {self.created_on}"


class Subscription(SuperModel):

email = models.EmailField(max_length=255)
Expand Down
Loading

0 comments on commit 4102290

Please sign in to comment.