Use doMaybeLocalRoomAction (#9038)

* Use doMaybeLocalRoomAction

* Revert unnecessary changes
This commit is contained in:
Michael Weimann 2022-07-13 07:56:36 +02:00 committed by GitHub
parent 9b8b8763f7
commit 3be20cf434
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 333 additions and 22 deletions

View file

@ -37,6 +37,7 @@ import { StaticNotificationState } from "../../../stores/notifications/StaticNot
import { NotificationColor } from "../../../stores/notifications/NotificationColor";
import InlineSpinner from "../elements/InlineSpinner";
import { PlaybackManager } from "../../../audio/PlaybackManager";
import { doMaybeLocalRoomAction } from "../../../utils/local-room";
interface IProps {
room: Room;
@ -103,7 +104,7 @@ export default class VoiceRecordComposerTile extends React.PureComponent<IProps,
try {
// noinspection ES6MissingAwait - we don't care if it fails, it'll get queued.
MatrixClientPeg.get().sendMessage(this.props.room.roomId, {
const content = {
"body": "Voice message",
//"msgtype": "org.matrix.msc2516.voice",
"msgtype": MsgType.Audio,
@ -132,7 +133,12 @@ export default class VoiceRecordComposerTile extends React.PureComponent<IProps,
waveform: this.state.recorder.getPlayback().thumbnailWaveform.map(v => Math.round(v * 1024)),
},
"org.matrix.msc3245.voice": {}, // No content, this is a rendering hint
});
};
doMaybeLocalRoomAction(
this.props.room.roomId,
(actualRoomId: string) => MatrixClientPeg.get().sendMessage(actualRoomId, content),
);
} catch (e) {
logger.error("Error sending voice message:", e);