Profile: Hide "When" on system accounts (#6455)

This commit is contained in:
zubiden 2025-11-11 14:37:34 +01:00 committed by Alexander Zinchuk
parent 6b12b40aa4
commit f0c3d78dd1

View File

@ -17,6 +17,7 @@ import type { IconName } from '../../../types/icons/index';
import type { AnimationLevel, ThemeKey } from '../../../types/index'; import type { AnimationLevel, ThemeKey } from '../../../types/index';
import { MediaViewerOrigin } from '../../../types/index'; import { MediaViewerOrigin } from '../../../types/index';
import { SERVICE_NOTIFICATIONS_USER_ID } from '../../../config.ts';
import { import {
getUserStatus, isAnonymousForwardsChat, isChatChannel, isSystemBot, isUserOnline, getUserStatus, isAnonymousForwardsChat, isChatChannel, isSystemBot, isUserOnline,
} from '../../../global/helpers/index'; } from '../../../global/helpers/index';
@ -97,6 +98,7 @@ type StateProps = {
isPlain?: boolean; isPlain?: boolean;
savedGifts?: ApiSavedGifts; savedGifts?: ApiSavedGifts;
hasAvatar?: boolean; hasAvatar?: boolean;
isSystemAccount?: boolean;
}; };
const MAX_LEVEL_ICON = 90; const MAX_LEVEL_ICON = 90;
@ -134,6 +136,7 @@ const ProfileInfo = ({
isPlain, isPlain,
savedGifts, savedGifts,
hasAvatar, hasAvatar,
isSystemAccount,
onExpand, onExpand,
}: OwnProps & StateProps) => { }: OwnProps & StateProps) => {
const { const {
@ -452,7 +455,7 @@ const ProfileInfo = ({
<span className={styles.userStatus} dir="auto"> <span className={styles.userStatus} dir="auto">
{getUserStatus(oldLang, user, userStatus)} {getUserStatus(oldLang, user, userStatus)}
</span> </span>
{userStatus?.isReadDateRestrictedByMe && ( {userStatus?.isReadDateRestrictedByMe && !isSystemAccount && (
<span className={styles.getStatus} onClick={handleOpenGetReadDateModal}> <span className={styles.getStatus} onClick={handleOpenGetReadDateModal}>
<span>{oldLang('StatusHiddenShow')}</span> <span>{oldLang('StatusHiddenShow')}</span>
</span> </span>
@ -635,6 +638,9 @@ export default memo(withGlobal<OwnProps>(
const savedGifts = selectPeerSavedGifts(global, peerId); const savedGifts = selectPeerSavedGifts(global, peerId);
const hasAvatar = Boolean(peer?.avatarPhotoId); const hasAvatar = Boolean(peer?.avatarPhotoId);
const isAnonymousForwards = isAnonymousForwardsChat(peerId);
const isSystemAccount = isSystemBot(peerId) || isAnonymousForwards || peer?.id === SERVICE_NOTIFICATIONS_USER_ID;
return { return {
user, user,
userFullInfo, userFullInfo,
@ -654,6 +660,7 @@ export default memo(withGlobal<OwnProps>(
isPlain: !hasBackground, isPlain: !hasBackground,
savedGifts, savedGifts,
hasAvatar, hasAvatar,
isSystemAccount,
}; };
}, },
)(ProfileInfo)); )(ProfileInfo));