forked from mystiq/hydrogen-web
Always include reply content
This commit is contained in:
parent
f44fa775de
commit
6a556d73ad
1 changed files with 1 additions and 17 deletions
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {getRelatedEventId, THREADING_RELATION_TYPE} from "../relations.js";
|
import {THREADING_RELATION_TYPE} from "../relations.js";
|
||||||
|
|
||||||
function htmlEscape(string) {
|
function htmlEscape(string) {
|
||||||
return string.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
return string.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||||
|
@ -60,11 +60,6 @@ function _createReplyContent(targetId, msgtype, body, formattedBody, threadId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createReplyContent(entry, msgtype, body) {
|
export function createReplyContent(entry, msgtype, body) {
|
||||||
// don't use entry.isReply here since we pretend that threads are replies
|
|
||||||
if (!entry.relation["m.in_reply_to"] && entry.isThread) {
|
|
||||||
return createThreadContent(entry, msgtype, body);
|
|
||||||
}
|
|
||||||
// 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);
|
||||||
const sender = entry.sender;
|
const sender = entry.sender;
|
||||||
|
@ -85,14 +80,3 @@ export function createReplyContent(entry, msgtype, body) {
|
||||||
const newFormattedBody = formattedFallback + htmlEscape(body);
|
const newFormattedBody = formattedFallback + htmlEscape(body);
|
||||||
return _createReplyContent(entry.id, msgtype, newBody, newFormattedBody, entry.threadEventId);
|
return _createReplyContent(entry.id, msgtype, newBody, newFormattedBody, entry.threadEventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createThreadContent(entry, msgtype, body) {
|
|
||||||
return {
|
|
||||||
msgtype,
|
|
||||||
body,
|
|
||||||
"m.relates_to": {
|
|
||||||
"rel_type": THREADING_RELATION_TYPE,
|
|
||||||
"event_id": getRelatedEventId(entry)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue