Compare commits

4 Commits
main ... dev

3 changed files with 31 additions and 7 deletions

View File

@@ -104,6 +104,12 @@ export function DialogInput() {
}, [dialog, editableDivRef]); }, [dialog, editableDivRef]);
useEffect(() => { useEffect(() => {
if(systemAccounts.find((acc) => acc.publicKey == dialog)){
/**
* У системных аккаунтов нельзя отвечать на сообщения
*/
return;
}
if(replyMessages.inDialogInput && replyMessages.inDialogInput == dialog){ if(replyMessages.inDialogInput && replyMessages.inDialogInput == dialog){
setAttachments([{ setAttachments([{
type: AttachmentType.MESSAGES, type: AttachmentType.MESSAGES,
@@ -111,8 +117,10 @@ export function DialogInput() {
blob: JSON.stringify([...replyMessages.messages]), blob: JSON.stringify([...replyMessages.messages]),
preview: "" preview: ""
}]); }]);
if(editableDivRef.current){
editableDivRef.current.focus(); editableDivRef.current.focus();
} }
}
}, [dialog, replyMessages]); }, [dialog, replyMessages]);
useEffect(() => { useEffect(() => {
@@ -208,6 +216,12 @@ export function DialogInput() {
} }
const onClickCamera = async () => { const onClickCamera = async () => {
if(systemAccounts.find((acc) => acc.publicKey == dialog)){
/**
* У системных аккаунтов нельзя вызывать вложения
*/
return;
}
if(avatars.length == 0){ if(avatars.length == 0){
return; return;
} }
@@ -217,8 +231,10 @@ export function DialogInput() {
type: AttachmentType.AVATAR, type: AttachmentType.AVATAR,
preview: await base64ImageToBlurhash(avatars[0].avatar) preview: await base64ImageToBlurhash(avatars[0].avatar)
}]); }]);
if(editableDivRef.current){
editableDivRef.current.focus(); editableDivRef.current.focus();
} }
}
const sendTypeingPacket = () => { const sendTypeingPacket = () => {
let packet = new PacketTyping(); let packet = new PacketTyping();
@@ -229,6 +245,12 @@ export function DialogInput() {
} }
const onPaste = async (event: React.ClipboardEvent) => { const onPaste = async (event: React.ClipboardEvent) => {
if(systemAccounts.find((acc) => acc.publicKey == dialog)){
/**
* У системных аккаунтов нельзя вызывать вложения
*/
return;
}
if(attachments.length >= MAX_ATTACHMENTS_IN_MESSAGE){ if(attachments.length >= MAX_ATTACHMENTS_IN_MESSAGE){
return; return;
} }
@@ -249,7 +271,9 @@ export function DialogInput() {
preview: await base64ImageToBlurhash(base64Image) preview: await base64ImageToBlurhash(base64Image)
}]); }]);
} }
if(editableDivRef.current){
editableDivRef.current.focus(); editableDivRef.current.focus();
}
break; break;
} }
} }

View File

@@ -19,8 +19,8 @@ export function MentionRow(props : MentionRowProps) {
{props.username == 'all' && <Avatar title="@" variant="filled" color={colors.brandColor}>@</Avatar>} {props.username == 'all' && <Avatar title="@" variant="filled" color={colors.brandColor}>@</Avatar>}
{props.username == 'admin' && <Avatar title="@" variant="filled" color={colors.error}>@</Avatar>} {props.username == 'admin' && <Avatar title="@" variant="filled" color={colors.error}>@</Avatar>}
{props.username != 'all' && props.username != 'admin' && <Avatar {props.username != 'all' && props.username != 'admin' && <Avatar
title={props.title} name={props.title}
variant="filled" variant="light"
color="initials" color="initials"
src={avatars.length > 0 ? avatars[0].avatar : null} src={avatars.length > 0 ? avatars[0].avatar : null}
></Avatar>} ></Avatar>}