Фикс установки аватарки у группы
This commit is contained in:
@@ -15,6 +15,7 @@ import { AVATAR_PASSWORD_TO_ENCODE } from "@/app/constants";
|
||||
import { useDialog } from "../DialogProvider/useDialog";
|
||||
import { useCore } from "@/app/hooks/useCore";
|
||||
import { MessageProps } from "@/app/components/Messages/Message";
|
||||
import { useGroups } from "../DialogProvider/useGroups";
|
||||
|
||||
export enum DownloadStatus {
|
||||
DOWNLOADED,
|
||||
@@ -39,6 +40,8 @@ export function useAttachment(attachment: Attachment, parentMessage: MessageProp
|
||||
const {info} = useConsoleLogger('useAttachment');
|
||||
const {updateAttachmentsInMessagesByAttachmentId} = useDialog();
|
||||
const {getDownloadsPath} = useCore();
|
||||
const {hasGroup} = useGroups();
|
||||
const {dialog} = useDialog();
|
||||
|
||||
const saveAvatar = useSaveAvatar();
|
||||
|
||||
@@ -186,7 +189,11 @@ export function useAttachment(attachment: Attachment, parentMessage: MessageProp
|
||||
/**
|
||||
* Устанавливаем аватарку тому, кто ее прислал.
|
||||
*/
|
||||
saveAvatar(parentMessage.from, avatarPath, decrypted);
|
||||
let avatarSetTo = parentMessage.from;
|
||||
if(hasGroup(dialog)){
|
||||
avatarSetTo = dialog;
|
||||
}
|
||||
saveAvatar(avatarSetTo, avatarPath, decrypted);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user