This commit is contained in:
PhilReact 2024-09-09 23:52:03 +03:00
parent 7c8c6eaba3
commit 1130628302
2 changed files with 3 additions and 2 deletions

View File

@ -3,12 +3,13 @@ import DOMPurify from 'dompurify';
import './styles.css'; // Ensure this CSS file is imported import './styles.css'; // Ensure this CSS file is imported
export const MessageDisplay = ({ htmlContent }) => { export const MessageDisplay = ({ htmlContent }) => {
const linkify = (text) => { const linkify = (text) => {
// Regular expression to find URLs starting with https://, http://, or www. // Regular expression to find URLs starting with https://, http://, or www.
const urlPattern = /(\bhttps?:\/\/[^\s<]+|\bwww\.[^\s<]+)/g; const urlPattern = /(\bhttps?:\/\/[^\s<]+|\bwww\.[^\s<]+)/g;
// Replace plain text URLs with anchor tags // Replace plain text URLs with anchor tags
return text.replace(urlPattern, (url) => { return text?.replace(urlPattern, (url) => {
const href = url.startsWith('http') ? url : `https://${url}`; const href = url.startsWith('http') ? url : `https://${url}`;
return `<a href="${href}" class="auto-link">${DOMPurify.sanitize(url)}</a>`; return `<a href="${href}" class="auto-link">${DOMPurify.sanitize(url)}</a>`;
}); });

View File

@ -762,6 +762,7 @@ export const Group = ({
const getMembers = async (groupId) => { const getMembers = async (groupId) => {
try { try {
const res = await getGroupMembers(groupId); const res = await getGroupMembers(groupId);
if(groupId !== selectedGroupRef.current?.groupId) return
setMembers(res); setMembers(res);
} catch (error) {} } catch (error) {}
}; };
@ -773,7 +774,6 @@ export const Group = ({
}, [selectedGroup?.groupId]); }, [selectedGroup?.groupId]);
const shouldReEncrypt = useMemo(() => { const shouldReEncrypt = useMemo(() => {
if (triedToFetchSecretKey && !secretKeyPublishDate) return true; if (triedToFetchSecretKey && !secretKeyPublishDate) return true;
if ( if (
!secretKeyPublishDate || !secretKeyPublishDate ||