@@ -8,6 +8,8 @@ import {useChat, usePeer} from '@stores/peers';
88import { BusinessWorkHours , Chat , ChatFull , GeoPoint , GroupCall , HelpTimezonesList , InputGroupCall , Photo , StoryItem , Document , MessageMedia , Timezone , User , UserFull , UserStatus } from '@layer' ;
99import getAudioTitles from '@appManagers/utils/docs/getAudioTitles' ;
1010import { useFullPeer } from '@stores/fullPeers' ;
11+ import { appSettings } from '@stores/appSettings' ;
12+ import getPeerPhoto from '@appManagers/utils/peers/getPeerPhoto' ;
1113import { useHotReloadGuard } from '@lib/solidjs/hotReloadGuard' ;
1214import { bindManagersToSession } from '@lib/accounts/bindManagersToAccount' ;
1315import createMiddleware from '@helpers/solid/createMiddleware' ;
@@ -18,7 +20,7 @@ import classNames from '@helpers/string/classNames';
1820import Row from '@components/rowTsx' ;
1921import formatUserPhone from '@components/wrappers/formatUserPhone' ;
2022import { copyTextToClipboard } from '@helpers/clipboard' ;
21- import { copyPhoneNumber , copyUsername } from '@helpers/copyContact' ;
23+ import { copyPeerId , copyPhoneNumber , copyUsername } from '@helpers/copyContact' ;
2224import safeWindowOpen from '@helpers/dom/safeWindowOpen' ;
2325import anchorCopy from '@helpers/dom/anchorCopy' ;
2426import getServerMessageId from '@appManagers/utils/messageId/getServerMessageId' ;
@@ -965,6 +967,50 @@ PeerProfile.ContactNote = () => {
965967 ) ;
966968} ;
967969
970+ PeerProfile . PeerId = ( ) => {
971+ const context = useContext ( PeerProfileContext ) ;
972+ const { i18n} = useHotReloadGuard ( ) ;
973+ const peerId = createMemo ( ( ) => {
974+ if ( ! appSettings . showPeerIds || ! context . canBeDetailed ( ) || context . isTopic ) {
975+ return ;
976+ }
977+
978+ return '' + Math . abs ( context . peerId ) ;
979+ } ) ;
980+
981+ const dcId = createMemo ( ( ) => {
982+ const photo = getPeerPhoto ( context . peer as User | Chat ) ;
983+ if ( photo ?. _ === 'userProfilePhoto' && photo . pFlags . personal ) {
984+ return ( ( context . fullPeer as UserFull . userFull ) ?. profile_photo as Photo . photo ) ?. dc_id ;
985+ }
986+
987+ return photo ?. dc_id ;
988+ } ) ;
989+
990+ const onClick = ( ) => copyPeerId ( peerId ( ) ) ;
991+
992+ return (
993+ < Show when = { peerId ( ) } >
994+ < Row
995+ clickable = { onClick }
996+ contextMenu = { {
997+ buttons : [ {
998+ icon : 'copy' ,
999+ text : 'Text.CopyLabel_Id' ,
1000+ onClick
1001+ } ]
1002+ } }
1003+ >
1004+ < Row . Icon icon = "tag_alt_filled" text = "ID" />
1005+ < Row . Title > < span dir = "ltr" > { peerId ( ) } </ span > </ Row . Title >
1006+ < Row . Subtitle subtitleRight = { dcId ( ) && i18n ( 'PeerInfo.DataCenter' , [ dcId ( ) ] ) } >
1007+ { i18n ( 'PeerInfo.Id' ) }
1008+ </ Row . Subtitle >
1009+ </ Row >
1010+ </ Show >
1011+ ) ;
1012+ } ;
1013+
9681014PeerProfile . Location = ( ) => {
9691015 const context = useContext ( PeerProfileContext ) ;
9701016 const { i18n} = useHotReloadGuard ( ) ;
@@ -2018,6 +2064,7 @@ PeerProfile.MainSection = () => {
20182064 < PeerProfile . Username />
20192065 < PeerProfile . Location />
20202066 < PeerProfile . Bio />
2067+ < PeerProfile . PeerId />
20212068 < PeerProfile . Link />
20222069 < PeerProfile . Birthday />
20232070 < PeerProfile . ContactNote />
0 commit comments