From a005b3509d407354aeab0b6d44e71cceff790246 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Mon, 17 Jan 2022 16:50:54 -0800 Subject: [PATCH] Add meta onion-location pointer --- api/views.py | 23 +++++++++++++++++++++-- frontend/templates/frontend/index.html | 2 +- frontend/views.py | 5 +++-- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/api/views.py b/api/views.py index 812b635b..b89fc61f 100644 --- a/api/views.py +++ b/api/views.py @@ -123,7 +123,7 @@ class OrderView(viewsets.ViewSet): return Response({'bad_request':'You are not allowed to see this order'},status.HTTP_403_FORBIDDEN) # 3.b If order is between public and WF2 - if order.status >= Order.Status.PUB and order.status > Order.Status.WFB: + if order.status >= Order.Status.PUB and order.status < Order.Status.WF2: data['price_now'], data['premium_now'] = Logics.price_and_premium_now(order) # 3. c) If maker and Public, add num robots in book, premium percentile and num similar orders. @@ -136,7 +136,7 @@ class OrderView(viewsets.ViewSet): elif not data['is_participant'] and order.status != Order.Status.PUB: return Response(data, status=status.HTTP_200_OK) - # For participants add positions, nicks and status as a message + # For participants add positions, nicks and status as a message and hold invoices status data['is_buyer'] = Logics.is_buyer(order,request.user) data['is_seller'] = Logics.is_seller(order,request.user) data['maker_nick'] = str(order.maker) @@ -146,6 +146,25 @@ class OrderView(viewsets.ViewSet): data['is_disputed'] = order.is_disputed data['ur_nick'] = request.user.username + # Add whether hold invoices are LOCKED (ACCEPTED) + # Is there a maker bond? If so, True if locked, False otherwise + if order.maker_bond: + data['maker_locked'] = order.maker_bond.status == LNPayment.Status.LOCKED + else: + data['maker_locked'] = False + + # Is there a taker bond? If so, True if locked, False otherwise + if order.taker_bond: + data['taker_locked'] = order.taker_bond.status == LNPayment.Status.LOCKED + else: + data['taker_locked'] = False + + # Is there an escrow? If so, True if locked, False otherwise + if order.trade_escrow: + data['escrow_locked'] = order.trade_escrow.status == LNPayment.Status.LOCKED + else: + data['escrow_locked'] = False + # If both bonds are locked, participants can see the final trade amount in sats. if order.taker_bond: if order.maker_bond.status == order.taker_bond.status == LNPayment.Status.LOCKED: diff --git a/frontend/templates/frontend/index.html b/frontend/templates/frontend/index.html index 34f11a4a..b23f90c9 100644 --- a/frontend/templates/frontend/index.html +++ b/frontend/templates/frontend/index.html @@ -1,7 +1,7 @@ - + {% comment %} TODO Add a proper fav icon {% endcomment %} diff --git a/frontend/views.py b/frontend/views.py index 5124628e..6b59e3cd 100644 --- a/frontend/views.py +++ b/frontend/views.py @@ -1,6 +1,7 @@ from django.shortcuts import render - +from decouple import config # Create your views here. def index(request, *args, **kwargs): - return render(request, 'frontend/index.html') \ No newline at end of file + context={'ONION_LOCATION': config('ONION_LOCATION')} + return render(request, 'frontend/index.html', context=context) \ No newline at end of file