Conform more of the codebase to strictNullChecks (#10672)

* Conform more of the codebase to `strictNullChecks`

* Iterate

* Iterate

* Iterate

* Iterate

* Conform more of the codebase to `strictNullChecks`

* Iterate

* Update record key
This commit is contained in:
Michael Telatynski 2023-04-21 11:50:42 +01:00 committed by GitHub
parent 792a39a39b
commit be5928cb64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 143 additions and 115 deletions

View file

@ -65,11 +65,11 @@ export const OverflowMenuContext = createContext<OverflowMenuCloser | null>(null
const MessageComposerButtons: React.FC<IProps> = (props: IProps) => {
const matrixClient = useContext(MatrixClientContext);
const { room, roomId, narrow } = useContext(RoomContext);
const { room, narrow } = useContext(RoomContext);
const isWysiwygLabEnabled = useSettingValue<boolean>("feature_wysiwyg_composer");
if (props.haveRecording) {
if (!matrixClient || !room || props.haveRecording) {
return null;
}
@ -93,7 +93,7 @@ const MessageComposerButtons: React.FC<IProps> = (props: IProps) => {
voiceRecordingButton(props, narrow),
startVoiceBroadcastButton(props),
props.showPollsButton ? pollButton(room, props.relation) : null,
showLocationButton(props, room, roomId, matrixClient),
showLocationButton(props, room, matrixClient),
];
} else {
mainButtons = [
@ -113,7 +113,7 @@ const MessageComposerButtons: React.FC<IProps> = (props: IProps) => {
voiceRecordingButton(props, narrow),
startVoiceBroadcastButton(props),
props.showPollsButton ? pollButton(room, props.relation) : null,
showLocationButton(props, room, roomId, matrixClient),
showLocationButton(props, room, matrixClient),
];
}
@ -127,7 +127,7 @@ const MessageComposerButtons: React.FC<IProps> = (props: IProps) => {
});
return (
<UploadButtonContextProvider roomId={roomId} relation={props.relation}>
<UploadButtonContextProvider roomId={room.roomId} relation={props.relation}>
{mainButtons}
{moreButtons.length > 0 && (
<AccessibleTooltipButton
@ -346,18 +346,13 @@ class PollButton extends React.PureComponent<IPollButtonProps> {
}
}
function showLocationButton(
props: IProps,
room: Room,
roomId: string,
matrixClient: MatrixClient,
): ReactElement | null {
const sender = room.getMember(matrixClient.getUserId()!);
function showLocationButton(props: IProps, room: Room, matrixClient: MatrixClient): ReactElement | null {
const sender = room.getMember(matrixClient.getSafeUserId());
return props.showLocationButton && sender ? (
<LocationButton
key="location"
roomId={roomId}
roomId={room.roomId}
relation={props.relation}
sender={sender}
menuPosition={props.menuPosition}