forked from mystiq/hydrogen-web
Rename reply function in reply.js
This commit is contained in:
parent
21b067eaff
commit
5a0bc55e54
2 changed files with 5 additions and 5 deletions
|
@ -18,7 +18,7 @@ import {BaseEntry} from "./BaseEntry.js";
|
||||||
import {REDACTION_TYPE} from "../../common.js";
|
import {REDACTION_TYPE} from "../../common.js";
|
||||||
import {createAnnotation, ANNOTATION_RELATION_TYPE, getRelationFromContent} from "../relations.js";
|
import {createAnnotation, ANNOTATION_RELATION_TYPE, getRelationFromContent} from "../relations.js";
|
||||||
import {PendingAnnotation} from "../PendingAnnotation.js";
|
import {PendingAnnotation} from "../PendingAnnotation.js";
|
||||||
import {reply} from "./reply.js"
|
import {createReplyContent} from "./reply.js"
|
||||||
|
|
||||||
/** Deals mainly with local echo for relations and redactions,
|
/** Deals mainly with local echo for relations and redactions,
|
||||||
* so it is shared between PendingEventEntry and EventEntry */
|
* so it is shared between PendingEventEntry and EventEntry */
|
||||||
|
@ -157,7 +157,7 @@ export class BaseEventEntry extends BaseEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
reply(msgtype, body) {
|
reply(msgtype, body) {
|
||||||
return reply(this, msgtype, body);
|
return createReplyContent(this, msgtype, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** takes both remote event id and local txn id into account, see overriding in PendingEventEntry */
|
/** takes both remote event id and local txn id into account, see overriding in PendingEventEntry */
|
||||||
|
|
|
@ -36,7 +36,7 @@ function fallbackPrefix(msgtype) {
|
||||||
return msgtype === "m.emote" ? "* " : "";
|
return msgtype === "m.emote" ? "* " : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function createReply(targetId, msgtype, body, formattedBody) {
|
function _createReplyContent(targetId, msgtype, body, formattedBody) {
|
||||||
return {
|
return {
|
||||||
msgtype,
|
msgtype,
|
||||||
body,
|
body,
|
||||||
|
@ -50,7 +50,7 @@ function createReply(targetId, msgtype, body, formattedBody) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reply(entry, msgtype, body) {
|
export function createReplyContent(entry, msgtype, body) {
|
||||||
// TODO check for absense of sender / body / msgtype / etc?
|
// TODO check for absense of sender / body / msgtype / etc?
|
||||||
const nonTextual = fallbackForNonTextualMessage(entry.content.msgtype);
|
const nonTextual = fallbackForNonTextualMessage(entry.content.msgtype);
|
||||||
const prefix = fallbackPrefix(entry.content.msgtype);
|
const prefix = fallbackPrefix(entry.content.msgtype);
|
||||||
|
@ -70,5 +70,5 @@ export function reply(entry, msgtype, body) {
|
||||||
|
|
||||||
const newBody = plainFallback + '\n\n' + body;
|
const newBody = plainFallback + '\n\n' + body;
|
||||||
const newFormattedBody = formattedFallback + htmlEscape(body);
|
const newFormattedBody = formattedFallback + htmlEscape(body);
|
||||||
return createReply(entry.id, msgtype, newBody, newFormattedBody);
|
return _createReplyContent(entry.id, msgtype, newBody, newFormattedBody);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue