From 3612c1489adf2351f07620695a4282680623b07a Mon Sep 17 00:00:00 2001 From: Johan Naizu <68628917+johan-naizu@users.noreply.github.com> Date: Mon, 20 May 2024 00:55:03 +0530 Subject: [PATCH] show Time rem only when status is PENDING (#530) * show Time rem only when status is PENDING Co-authored-by: Aki <113102703+Aki-works@users.noreply.github.com> * Code cleaned Co-authored-by: Aki <113102703+Aki-works@users.noreply.github.com> * formatting * change let to const --------- Co-authored-by: Aki <113102703+Aki-works@users.noreply.github.com> --- bot/modules/orders/messages.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bot/modules/orders/messages.js b/bot/modules/orders/messages.js index 908eb6ec..b6dcec4d 100644 --- a/bot/modules/orders/messages.js +++ b/bot/modules/orders/messages.js @@ -21,17 +21,20 @@ exports.listOrdersResponse = async (orders, i18n) => { if (typeof order.amount !== 'undefined') amount = order.amount; const timeToExpire = getTimeToExpirationOrder(order, i18n); - return [ + const details = [ [''].join(''), ['`Id `: ', '`', order.id, '`'].join(''), ['`Status `: ', '`', status, '`'].join(''), - ['`Time rem`: ', '`', timeToExpire, '`'].join(''), ['`Sats amt`: ', '`', amount, '`'].join(''), ['`Fiat amt`: ', '`', fiatAmount, '`'].join(''), ['`Fiat `: ', '`', order.fiat_code, '`'].join(''), ['`Channel `: ', '`', sanitizeMD(channel), '`'].join(''), ['`_________________________________`'].join(''), - ].join('\n'); + ]; + if (status === 'PENDING') { + details.splice(3, 0, ['`Time rem`: ', '`', timeToExpire, '`'].join('')); + } + return details.join('\n'); }); const lines = await Promise.all(tasks); const body = lines.join('\n');