mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-10 01:00:28 +03:00
Refectored Message comp
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
f628a6c3d6
commit
7e7a5e692e
11 changed files with 453 additions and 530 deletions
|
|
@ -95,13 +95,13 @@ function getFormattedBody(markdown) {
|
|||
function getReplyFormattedBody(roomId, reply) {
|
||||
const replyToLink = `<a href="https://matrix.to/#/${roomId}/${reply.eventId}">In reply to</a>`;
|
||||
const userLink = `<a href="https://matrix.to/#/${reply.userId}">${reply.userId}</a>`;
|
||||
const formattedReply = getFormattedBody(reply.content.replaceAll('\n', '\n> '));
|
||||
const formattedReply = getFormattedBody(reply.body.replaceAll('\n', '\n> '));
|
||||
return `<mx-reply><blockquote>${replyToLink}${userLink}<br />${formattedReply}</blockquote></mx-reply>`;
|
||||
}
|
||||
|
||||
function bindReplyToContent(roomId, reply, content) {
|
||||
const newContent = { ...content };
|
||||
newContent.body = `> <${reply.userId}> ${reply.content.replaceAll('\n', '\n> ')}`;
|
||||
newContent.body = `> <${reply.userId}> ${reply.body.replaceAll('\n', '\n> ')}`;
|
||||
newContent.body += `\n\n${content.body}`;
|
||||
newContent.format = 'org.matrix.custom.html';
|
||||
newContent['m.relates_to'] = content['m.relates_to'] || {};
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ const cons = {
|
|||
OPEN_EMOJIBOARD: 'OPEN_EMOJIBOARD',
|
||||
OPEN_READRECEIPTS: 'OPEN_READRECEIPTS',
|
||||
OPEN_ROOMOPTIONS: 'OPEN_ROOMOPTIONS',
|
||||
CLICK_REPLY_TO: 'CLICK_REPLY_TO',
|
||||
},
|
||||
room: {
|
||||
JOIN: 'JOIN',
|
||||
|
|
@ -65,6 +66,7 @@ const cons = {
|
|||
EMOJIBOARD_OPENED: 'EMOJIBOARD_OPENED',
|
||||
READRECEIPTS_OPENED: 'READRECEIPTS_OPENED',
|
||||
ROOMOPTIONS_OPENED: 'ROOMOPTIONS_OPENED',
|
||||
REPLY_TO_CLICKED: 'REPLY_TO_CLICKED',
|
||||
},
|
||||
roomList: {
|
||||
ROOMLIST_UPDATED: 'ROOMLIST_UPDATED',
|
||||
|
|
|
|||
|
|
@ -90,6 +90,14 @@ class Navigation extends EventEmitter {
|
|||
action.roomId,
|
||||
);
|
||||
},
|
||||
[cons.actions.navigation.CLICK_REPLY_TO]: () => {
|
||||
this.emit(
|
||||
cons.events.navigation.REPLY_TO_CLICKED,
|
||||
action.userId,
|
||||
action.eventId,
|
||||
action.body,
|
||||
);
|
||||
},
|
||||
};
|
||||
actions[action.type]?.();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue