From dbb91bf16c1eb7d23db07f2016f504b1b543ad03 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sat, 22 Jun 2024 18:26:28 +0200 Subject: [PATCH] fix(offline indicator): change last online check from 30 to 60 minutes for a better estimate --- src/components/sidebar/sidebar.tsx | 2 +- src/views/subplebbit/subplebbit.tsx | 2 +- src/views/subplebbits/subplebbits.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/sidebar/sidebar.tsx b/src/components/sidebar/sidebar.tsx index 45251626..9bd79cb2 100644 --- a/src/components/sidebar/sidebar.tsx +++ b/src/components/sidebar/sidebar.tsx @@ -135,7 +135,7 @@ const Sidebar = ({ comment, isSubCreatedButNotYetPublished, settings, subplebbit const { cid, downvoteCount, timestamp, upvoteCount } = comment || {}; const { allActiveUserCount, hourActiveUserCount } = useSubplebbitStats({ subplebbitAddress: address }); - const isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 30; + const isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 60; const onlineNotice = t('users_online', { count: hourActiveUserCount }); const offlineNotice = updatedAt && t('posts_last_synced', { dateAgo: getFormattedTimeAgo(updatedAt) }); const onlineStatus = isOnline ? onlineNotice : offlineNotice; diff --git a/src/views/subplebbit/subplebbit.tsx b/src/views/subplebbit/subplebbit.tsx index b67c1d97..3fcae4a8 100644 --- a/src/views/subplebbit/subplebbit.tsx +++ b/src/views/subplebbit/subplebbit.tsx @@ -42,7 +42,7 @@ const Subplebbit = () => { ); - let isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 30; + let isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 60; const isSubCreatedButNotYetPublished = typeof createdAt === 'number' && !updatedAt; const { blocked } = useBlock({ address: subplebbitAddress }); diff --git a/src/views/subplebbits/subplebbits.tsx b/src/views/subplebbits/subplebbits.tsx index d6c3132f..2c460195 100644 --- a/src/views/subplebbits/subplebbits.tsx +++ b/src/views/subplebbits/subplebbits.tsx @@ -130,7 +130,7 @@ const Subplebbit = ({ subplebbit }: SubplebbitProps) => { const postScore = upvoteCount === 0 && downvoteCount === 0 ? '•' : upvoteCount - downvoteCount || '•'; const { allActiveUserCount } = useSubplebbitStats({ subplebbitAddress: address }); - const isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 30; + const isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 60; return (