@@ -20,6 +20,7 @@ import { M_POLL_START } from "matrix-events-sdk";
20
20
import React , { createContext , ReactElement , useContext } from 'react' ;
21
21
import { Room } from 'matrix-js-sdk/src/models/room' ;
22
22
import { MatrixClient } from 'matrix-js-sdk/src/client' ;
23
+ import { RelationType } from 'matrix-js-sdk/src/@types/event' ;
23
24
24
25
import { _t } from '../../../languageHandler' ;
25
26
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton" ;
@@ -73,7 +74,7 @@ const MessageComposerButtons: React.FC<IProps> = (props: IProps) => {
73
74
uploadButton ( props , roomId ) ,
74
75
showStickersButton ( props ) ,
75
76
voiceRecordingButton ( props ) ,
76
- pollButton ( room ) ,
77
+ pollButton ( room , props . relation ) ,
77
78
showLocationButton ( props , room , roomId , matrixClient ) ,
78
79
] ;
79
80
} else {
@@ -84,7 +85,7 @@ const MessageComposerButtons: React.FC<IProps> = (props: IProps) => {
84
85
moreButtons = [
85
86
showStickersButton ( props ) ,
86
87
voiceRecordingButton ( props ) ,
87
- pollButton ( room ) ,
88
+ pollButton ( room , props . relation ) ,
88
89
showLocationButton ( props , room , roomId , matrixClient ) ,
89
90
] ;
90
91
}
@@ -288,12 +289,13 @@ function voiceRecordingButton(props: IProps): ReactElement {
288
289
) ;
289
290
}
290
291
291
- function pollButton ( room : Room ) : ReactElement {
292
- return < PollButton key = "polls" room = { room } /> ;
292
+ function pollButton ( room : Room , relation ?: IEventRelation ) : ReactElement {
293
+ return < PollButton key = "polls" room = { room } relation = { relation } /> ;
293
294
}
294
295
295
296
interface IPollButtonProps {
296
297
room : Room ;
298
+ relation ?: IEventRelation ;
297
299
}
298
300
299
301
class PollButton extends React . PureComponent < IPollButtonProps > {
@@ -319,12 +321,17 @@ class PollButton extends React.PureComponent<IPollButtonProps> {
319
321
} ,
320
322
) ;
321
323
} else {
324
+ const threadId = this . props . relation . rel_type === RelationType . Thread
325
+ ? this . props . relation . event_id
326
+ : null ;
327
+
322
328
Modal . createTrackedDialog (
323
329
'Polls' ,
324
330
'create' ,
325
331
PollCreateDialog ,
326
332
{
327
333
room : this . props . room ,
334
+ threadId,
328
335
} ,
329
336
'mx_CompoundDialog' ,
330
337
false , // isPriorityModal
0 commit comments