Message: Show correct message sender when forwarding (#1784)

This commit is contained in:
Alexander Zinchuk 2022-03-25 13:14:58 +01:00
parent 395786e0f9
commit 1d797bc3ba
2 changed files with 6 additions and 5 deletions

View File

@ -54,7 +54,7 @@ const EmbeddedMessage: FC<OwnProps> = ({
const lang = useLang();
const senderTitle = sender && getSenderTitle(lang, sender);
const senderTitle = message?.forwardInfo?.hiddenUserName || (sender && getSenderTitle(lang, sender));
return (
<div

View File

@ -148,10 +148,9 @@ export default memo(withGlobal<OwnProps>(
}
let sender: ApiChat | ApiUser | undefined;
if (replyingToId && message) {
if ((isForwarding || replyingToId) && message) {
const { forwardInfo } = message;
const isChatWithSelf = chatId === currentUserId;
if (forwardInfo && (forwardInfo.isChannelPost || isChatWithSelf)) {
sender = selectForwardedSender(global, message);
}
@ -159,8 +158,10 @@ export default memo(withGlobal<OwnProps>(
if (!sender) {
sender = selectSender(global, message);
}
} else if (isForwarding) {
sender = isUserId(fromChatId!) ? selectUser(global, fromChatId!) : selectChat(global, fromChatId!);
if (!sender) {
sender = isUserId(fromChatId!) ? selectUser(global, fromChatId!) : selectChat(global, fromChatId!);
}
}
return {