@@ -19,7 +19,7 @@ limitations under the License.
1919import React , { ReactElement , useEffect } from 'react' ;
2020import { EventStatus , MatrixEvent , MatrixEventEvent } from 'matrix-js-sdk/src/models/event' ;
2121import classNames from 'classnames' ;
22- import { MsgType } from 'matrix-js-sdk/src/@types/event' ;
22+ import { MsgType , RelationType } from 'matrix-js-sdk/src/@types/event' ;
2323
2424import type { Relations } from 'matrix-js-sdk/src/models/relations' ;
2525import { _t } from '../../../languageHandler' ;
@@ -166,7 +166,7 @@ interface IMessageActionBarProps {
166166 isQuoteExpanded ?: boolean ;
167167 getRelationsForEvent ?: (
168168 eventId : string ,
169- relationType : string ,
169+ relationType : RelationType | string ,
170170 eventType : string
171171 ) => Relations ;
172172}
@@ -303,11 +303,19 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
303303 key = "cancel"
304304 /> ;
305305
306+ const hasARelation = ! ! this . props . mxEvent ?. getRelation ( ) ?. rel_type ;
307+
306308 const threadTooltipButton = < CardContext . Consumer key = "thread" >
307309 { context =>
308310 < RovingAccessibleTooltipButton
309311 className = "mx_MessageActionBar_maskButton mx_MessageActionBar_threadButton"
310- title = { _t ( "Reply in thread" ) }
312+
313+ disabled = { hasARelation }
314+ title = { ! hasARelation
315+ ? _t ( "Reply in thread" )
316+ : _t ( "Can't create a thread from an event with an existing relation" )
317+ }
318+
311319 onClick = { this . onThreadClick . bind ( null , context . isCard ) }
312320 />
313321 }
0 commit comments