From 2adb7e352802c798d8a0aafb0f5d202698bbfb11 Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Sun, 20 Jun 2021 19:21:28 +0300 Subject: [PATCH] Don't show saved messages in top peers Don't show '0 seconds' in call duration --- src/components/appSearchSuper..ts | 5 +++++ src/helpers/formatDuration.ts | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/appSearchSuper..ts b/src/components/appSearchSuper..ts index 2d73f217..7f23f1f4 100644 --- a/src/components/appSearchSuper..ts +++ b/src/components/appSearchSuper..ts @@ -826,6 +826,11 @@ export default class AppSearchSuper { appUsersManager.getTopPeers().then(peers => { if(!middleware()) return; + const idx = peers.indexOf(rootScope.myId); + if(idx !== -1) { + peers = peers.slice(); + peers.splice(idx, 1); + } //console.log('got top categories:', categories); if(peers.length) { peers.forEach((peerId) => { diff --git a/src/helpers/formatDuration.ts b/src/helpers/formatDuration.ts index 79554a4e..f9185b28 100644 --- a/src/helpers/formatDuration.ts +++ b/src/helpers/formatDuration.ts @@ -34,5 +34,12 @@ export default function formatDuration(duration: number, showLast = 2) { }); }); - return d.slice(-showLast).reverse(); + const out = d.slice(-showLast).reverse(); + for(let i = out.length - 1; i >= 0; --i) { + if(out[i].duration === 0) { + out.splice(i, 1); + } + } + + return out; }