mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-02-07 04:21:01 -05:00
Do not disclose exact last online time for privacy reasons
This commit is contained in:
@@ -292,7 +292,7 @@ function LastOnline(props: { lastOnlineTime?: string }) {
|
||||
return (
|
||||
<AboutRow
|
||||
icon={<ClockIcon className="h-5 w-5"/>}
|
||||
text={'Last online ' + fromNow(lastOnlineTime)}
|
||||
text={'Last online ' + fromNow(lastOnlineTime, true)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import {Col} from 'web/components/layout/col'
|
||||
import {Row} from 'web/components/layout/row'
|
||||
import {SendMessageButton} from 'web/components/messaging/send-message-button'
|
||||
import ProfilePrimaryInfo from './profile-primary-info'
|
||||
import {OnlineIcon} from '../online-icon'
|
||||
import {track} from 'web/lib/service/analytics'
|
||||
import DropdownMenu from 'web/components/comments/dropdown-menu'
|
||||
import {ShareProfileButton} from '../widgets/share-profile-button'
|
||||
@@ -58,7 +57,7 @@ export default function ProfileHeader(props: {
|
||||
{currentUser && isCurrentUser && disabled &&
|
||||
<div className="text-red-500">You disabled your profile, so no one else can access it.</div>}
|
||||
<Row className="items-center gap-1 text-xl">
|
||||
{!isCurrentUser && <OnlineIcon last_online_time={userActivity?.last_online_time}/>}
|
||||
{/*{!isCurrentUser && <OnlineIcon last_online_time={userActivity?.last_online_time}/>}*/}
|
||||
<span>
|
||||
{simpleView ? (
|
||||
<Link className={linkClass} href={`/${user.username}`}>
|
||||
|
||||
@@ -3,8 +3,12 @@ import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
|
||||
dayjs.extend(relativeTime)
|
||||
|
||||
export function fromNow(time: number | string | Date) {
|
||||
return dayjs(time).fromNow()
|
||||
export function fromNow(time: number | string | Date, privacy: boolean = false) {
|
||||
const date = dayjs(time);
|
||||
if (privacy && dayjs().diff(date, 'hour') < 24) {
|
||||
return 'in the past day';
|
||||
}
|
||||
return date.fromNow();
|
||||
}
|
||||
|
||||
const FORMATTER = new Intl.DateTimeFormat('default', {
|
||||
|
||||
Reference in New Issue
Block a user