@@ -35,6 +35,8 @@ import {makeMediaSize} from '../helpers/mediaSize';
3535import type { MyStarGift } from '../lib/appManagers/appGiftsManager' ;
3636import IS_PARALLAX_SUPPORTED from '../environment/parallaxSupport' ;
3737import { generateDelimiter } from './generateDelimiter' ;
38+ import { attachClickEvent } from '../helpers/dom/clickEvent' ;
39+ import ListenerSetter from '../helpers/listenerSetter' ;
3840
3941type PeerProfileContextValue = {
4042 peerId : PeerId ,
@@ -49,6 +51,8 @@ type PeerProfileContextValue = {
4951 canBeDetailed : ( ) => boolean ,
5052 isSavedDialog : boolean ,
5153 isTopic : boolean ,
54+ isBotforum : boolean ,
55+ needSimpleAvatar : boolean ,
5256 getDetailsForUse : ( ) => { peerId : PeerId , threadId ?: number } ,
5357 verifyContext : ( peerId : PeerId , threadId ?: number ) => boolean ,
5458} ;
@@ -110,7 +114,13 @@ const PeerProfile = (props: {
110114 } ,
111115 isSavedDialog : ! ! ( props . peerId === rootScope . myId && props . threadId ) ,
112116 get isTopic ( ) {
113- return ! ! ( props . threadId && ( value . peer as Chat . channel ) . pFlags . forum ) ;
117+ return ! ! ( props . threadId && ( ( value . peer as Chat . channel ) . pFlags . forum || value . isBotforum ) ) ;
118+ } ,
119+ get isBotforum ( ) {
120+ return ! ! ( value . peer as User . user ) . pFlags . bot_forum_view ;
121+ } ,
122+ get needSimpleAvatar ( ) {
123+ return value . isTopic ;
114124 } ,
115125 canBeDetailed : ( ) => value . peerId !== rootScope . myId || ! value . isDialog ,
116126 getDetailsForUse : ( ) => {
@@ -165,7 +175,7 @@ const PeerProfile = (props: {
165175 value . peerId === rootScope . myId && 'is-me'
166176 ) }
167177 >
168- < Show when = { ! value . isTopic } >
178+ < Show when = { ! value . needSimpleAvatar } >
169179 < PeerProfile . AutoAvatar />
170180 </ Show >
171181 < Show when = { props . changeAvatarBtn } >
@@ -192,7 +202,7 @@ PeerProfile.Avatar = () => {
192202 const name = ( < PeerProfile . Name /> ) as HTMLElement ;
193203 const subtitle = ( < PeerProfile . Subtitle /> ) as HTMLElement ;
194204
195- if ( ! context . isTopic ) {
205+ if ( ! context . needSimpleAvatar ) {
196206 const avatars = new PeerProfileAvatars (
197207 context . scrollable ,
198208 rootScope . managers ,
@@ -330,17 +340,24 @@ PeerProfile.SubtitleStatus = () => {
330340 }
331341
332342 const { peerId, isDialog} = context ;
333-
334- const isForum = ! ! ( context . peer as Chat . channel ) . pFlags . forum ;
335343 const middleware = createMiddleware ( ) . get ( ) ;
336- if ( isForum && context . threadId ) {
344+ if ( context . isTopic ) {
337345 const [ element ] = createResource ( ( ) => {
346+ const listenerSetter = new ListenerSetter ( ) ;
347+ onCleanup ( ( ) => listenerSetter . removeAll ( ) ) ;
338348 return wrapTopicNameButton ( {
339349 peerId,
350+ withIcons : false ,
351+ noAvatarAndLink : true ,
340352 wrapOptions : {
341353 middleware
342354 }
343- } ) . then ( ( { element} ) => element ) ;
355+ } ) . then ( ( { element} ) => {
356+ attachClickEvent ( element , ( e ) => {
357+ appImManager . setPeer ( { peerId} ) ;
358+ } , { listenerSetter} ) ;
359+ return element ;
360+ } ) ;
344361 } ) ;
345362
346363 return (
@@ -1071,19 +1088,21 @@ PeerProfile.MainSection = () => {
10711088 return (
10721089 < Section
10731090 noDelimiter
1074- contentProps = { { class : classNames ( context . isTopic && 'has-simple-avatar' ) } }
1091+ contentProps = { { class : classNames ( context . needSimpleAvatar && 'has-simple-avatar' ) } }
10751092 >
1076- < Show when = { context . isTopic } >
1093+ < Show when = { context . needSimpleAvatar } >
10771094 < PeerProfile . AutoAvatar />
10781095 </ Show >
1079- < PeerProfile . Phone />
1080- < PeerProfile . Username />
1081- < PeerProfile . Location />
1082- < PeerProfile . Bio />
1083- < PeerProfile . Link />
1084- < PeerProfile . BusinessHours />
1085- < PeerProfile . BusinessLocation />
1086- < PeerProfile . Notifications />
1096+ < Show when = { ! ( context . isBotforum && context . threadId ) } >
1097+ < PeerProfile . Phone />
1098+ < PeerProfile . Username />
1099+ < PeerProfile . Location />
1100+ < PeerProfile . Bio />
1101+ < PeerProfile . Link />
1102+ < PeerProfile . BusinessHours />
1103+ < PeerProfile . BusinessLocation />
1104+ < PeerProfile . Notifications />
1105+ </ Show >
10871106 </ Section >
10881107 ) ;
10891108} ;
0 commit comments