diff --git a/src/app/atoms/avatar/Avatar.scss b/src/app/atoms/avatar/Avatar.scss
index 42efbe7..9df0027 100644
--- a/src/app/atoms/avatar/Avatar.scss
+++ b/src/app/atoms/avatar/Avatar.scss
@@ -24,7 +24,7 @@
height: var(--av-extra-small);
}
- img {
+ > img {
width: 100%;
height: 100%;
object-fit: cover;
diff --git a/src/app/organisms/room/common.jsx b/src/app/organisms/room/common.jsx
index dde94a3..2120e78 100644
--- a/src/app/organisms/room/common.jsx
+++ b/src/app/organisms/room/common.jsx
@@ -1,20 +1,16 @@
import React from 'react';
-import parse from 'html-react-parser';
-import twemoji from 'twemoji';
-import { sanitizeText } from '../../../util/sanitize';
+import { twemojify } from '../../../util/twemojify';
import initMatrix from '../../../client/initMatrix';
import { getUsername, getUsernameOfRoomMember } from '../../../util/matrixUtil';
-const getEmojifiedJsx = (username) => parse(twemoji.parse(sanitizeText(username)));
-
function getTimelineJSXMessages() {
return {
join(user) {
return (
<>
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
{' joined the room'}
>
);
@@ -23,27 +19,27 @@ function getTimelineJSXMessages() {
const reasonMsg = (typeof reason === 'string') ? `: ${reason}` : '';
return (
<>
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
{' left the room'}
- {getEmojifiedJsx(reasonMsg)}
+ {twemojify(reasonMsg)}
>
);
},
invite(inviter, user) {
return (
<>
- {getEmojifiedJsx(inviter)}
+ {twemojify(inviter)}
{' invited '}
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
>
);
},
cancelInvite(inviter, user) {
return (
<>
- {getEmojifiedJsx(inviter)}
+ {twemojify(inviter)}
{' canceled '}
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
{'\'s invite'}
>
);
@@ -51,7 +47,7 @@ function getTimelineJSXMessages() {
rejectInvite(user) {
return (
<>
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
{' rejected the invitation'}
>
);
@@ -60,10 +56,10 @@ function getTimelineJSXMessages() {
const reasonMsg = (typeof reason === 'string') ? `: ${reason}` : '';
return (
<>
- {getEmojifiedJsx(actor)}
+ {twemojify(actor)}
{' kicked '}
- {getEmojifiedJsx(user)}
- {getEmojifiedJsx(reasonMsg)}
+ {twemojify(user)}
+ {twemojify(reasonMsg)}
>
);
},
@@ -71,26 +67,26 @@ function getTimelineJSXMessages() {
const reasonMsg = (typeof reason === 'string') ? `: ${reason}` : '';
return (
<>
- {getEmojifiedJsx(actor)}
+ {twemojify(actor)}
{' banned '}
- {getEmojifiedJsx(user)}
- {getEmojifiedJsx(reasonMsg)}
+ {twemojify(user)}
+ {twemojify(reasonMsg)}
>
);
},
unban(actor, user) {
return (
<>
- {getEmojifiedJsx(actor)}
+ {twemojify(actor)}
{' unbanned '}
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
>
);
},
avatarSets(user) {
return (
<>
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
{' set the avatar'}
>
);
@@ -98,7 +94,7 @@ function getTimelineJSXMessages() {
avatarChanged(user) {
return (
<>
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
{' changed the avatar'}
>
);
@@ -106,7 +102,7 @@ function getTimelineJSXMessages() {
avatarRemoved(user) {
return (
<>
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
{' removed the avatar'}
>
);
@@ -114,27 +110,27 @@ function getTimelineJSXMessages() {
nameSets(user, newName) {
return (
<>
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
{' set the display name to '}
- {getEmojifiedJsx(newName)}
+ {twemojify(newName)}
>
);
},
nameChanged(user, newName) {
return (
<>
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
{' changed the display name to '}
- {getEmojifiedJsx(newName)}
+ {twemojify(newName)}
>
);
},
nameRemoved(user, lastName) {
return (
<>
- {getEmojifiedJsx(user)}
+ {twemojify(user)}
{' removed the display name '}
- {getEmojifiedJsx(lastName)}
+ {twemojify(lastName)}
>
);
},
@@ -147,7 +143,7 @@ function getUsersActionJsx(roomId, userIds, actionStr) {
if (room?.getMember(userId)) return getUsernameOfRoomMember(room.getMember(userId));
return getUsername(userId);
};
- const getUserJSX = (userId) => {getEmojifiedJsx(getUserDisplayName(userId))};
+ const getUserJSX = (userId) => {twemojify(getUserDisplayName(userId))};
if (!Array.isArray(userIds)) return 'Idle';
if (userIds.length === 0) return 'Idle';
const MAX_VISIBLE_COUNT = 3;