mirror of
https://github.com/RoboSats/robosats.git
synced 2025-07-17 08:13:19 +00:00
Include more order info when there is a password
This commit is contained in:
11
api/views.py
11
api/views.py
@ -257,10 +257,6 @@ class OrderView(viewsets.ViewSet):
|
||||
if is_penalized:
|
||||
data["penalty"] = request.user.robot.penalty_expiration
|
||||
|
||||
# 2.1) If order has a password
|
||||
if not data["is_participant"] and data["has_password"]:
|
||||
return Response(data, status.HTTP_200_OK)
|
||||
|
||||
# 3.a) If not a participant and order is not public, forbid.
|
||||
if (
|
||||
order.maker != request.user
|
||||
@ -310,6 +306,12 @@ class OrderView(viewsets.ViewSet):
|
||||
)
|
||||
)
|
||||
|
||||
data["satoshis_now"] = order.last_satoshis
|
||||
|
||||
# 4.b) If order has a password
|
||||
if not data["is_participant"] and data["has_password"]:
|
||||
return Response(data, status.HTTP_200_OK)
|
||||
|
||||
# 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)
|
||||
@ -323,7 +325,6 @@ class OrderView(viewsets.ViewSet):
|
||||
data["longitude"] = order.longitude
|
||||
data["is_disputed"] = order.is_disputed
|
||||
data["ur_nick"] = request.user.username
|
||||
data["satoshis_now"] = order.last_satoshis
|
||||
|
||||
# Add whether hold invoices are LOCKED (ACCEPTED)
|
||||
# Is there a maker bond? If so, True if locked, False otherwise
|
||||
|
@ -508,7 +508,8 @@ class TradeTest(BaseAPITestCase):
|
||||
data = trade.response.json()
|
||||
self.assertEqual(trade.response.status_code, 200)
|
||||
self.assertTrue(data["has_password"])
|
||||
self.assertNotIn("maker_nick", data)
|
||||
self.assertIsInstance(data["satoshis_now"], int)
|
||||
self.assertNotIn("is_buyer", data)
|
||||
|
||||
# Take with no password
|
||||
trade.take_order()
|
||||
|
Reference in New Issue
Block a user