Skip to content

Commit

Permalink
removes some dead code from when kudos was first made
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki committed Jan 26, 2019
1 parent 3fb9ccd commit 1666f82
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,30 +1242,19 @@ def profile(request, handle):
context['sent_kudos_count'] = sent_kudos.count()

if request.method == 'POST' and request.is_ajax():
# Send kudos data when new preferred address
address = request.POST.get('address')
context['kudos'] = profile.get_my_kudos.order_by('id', order_by)
context['sent_kudos'] = profile.get_sent_kudos.order_by('id', order_by)
profile.preferred_payout_address = address
kudos_html = loader.render_to_string('shared/profile_kudos.html', context)

try:
# Update profile address data when new preferred address is sent
validated = request.user.is_authenticated and request.user.username.lower() == profile.handle.lower()
if validated and request.POST.get('address'):
address = request.POST.get('address')
profile.preferred_payout_address = address
profile.save()
except Exception as e:
logger.error(e)
msg = {
'status': 500,
'msg': _('Internal server error'),
}
else:
msg = {
'status': 200,
'msg': _('Success!'),
'wallets': [profile.preferred_payout_address, ],
'kudos_html': kudos_html,
}

return JsonResponse(msg, status=msg.get('status', 200))
return JsonResponse(msg, status=msg.get('status', 200))
return TemplateResponse(request, 'profiles/profile.html', context, status=status)


Expand Down

0 comments on commit 1666f82

Please sign in to comment.