mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-11-20 03:25:52 +01:00
cleanup reply code a bit, have only 1 path to send message
This commit is contained in:
parent
e33209b747
commit
dfaaf6d234
@ -237,7 +237,7 @@ room.sendEvent(eventEntry.eventType, replacement);
|
||||
## Replies
|
||||
|
||||
```js
|
||||
const reply = eventEntry.reply({});
|
||||
const reply = eventEntry.createReplyContent({});
|
||||
room.sendEvent("m.room.message", reply);
|
||||
```
|
||||
|
||||
|
@ -200,13 +200,14 @@ export class RoomViewModel extends ErrorReportViewModel {
|
||||
message = message.substr(4).trim();
|
||||
msgtype = "m.emote";
|
||||
}
|
||||
let content;
|
||||
if (replyingTo) {
|
||||
log.set("replyingTo", replyingTo.eventId);
|
||||
// TODO: reply should not send? it should just return the content for the reply and we send it ourselves
|
||||
await replyingTo.reply(msgtype, message);
|
||||
content = await replyingTo.createReplyContent(msgtype, message);
|
||||
} else {
|
||||
await this._room.sendEvent("m.room.message", {msgtype, body: message}, undefined, log);
|
||||
content = {msgtype, body: message};
|
||||
}
|
||||
await this._room.sendEvent("m.room.message", content, undefined, log);
|
||||
success = true;
|
||||
}
|
||||
log.set("success", success);
|
||||
|
@ -146,8 +146,8 @@ export class BaseMessageTile extends SimpleTile {
|
||||
this._roomVM.startReply(this._entry);
|
||||
}
|
||||
|
||||
reply(msgtype, body, log = null) {
|
||||
return this._room.sendEvent("m.room.message", this._entry.reply(msgtype, body), null, log);
|
||||
createReplyContent(msgtype, body) {
|
||||
return this._entry.createReplyContent(msgtype, body);
|
||||
}
|
||||
|
||||
redact(reason, log) {
|
||||
|
@ -181,7 +181,7 @@ export class BaseEventEntry extends BaseEntry {
|
||||
return createAnnotation(this.id, key);
|
||||
}
|
||||
|
||||
reply(msgtype, body) {
|
||||
createReplyContent(msgtype, body) {
|
||||
return createReplyContent(this, msgtype, body);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user