mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-27 04:45:08 +01:00
Message: Show correct message sender when forwarding (another attempt) (#1822)
This commit is contained in:
parent
2866922d3c
commit
b06bbe1197
@ -54,7 +54,7 @@ const EmbeddedMessage: FC<OwnProps> = ({
|
|||||||
|
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
|
|
||||||
const senderTitle = sender && getSenderTitle(lang, sender);
|
const senderTitle = message?.forwardInfo?.hiddenUserName || (sender && getSenderTitle(lang, sender));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
@ -16,6 +16,7 @@ import {
|
|||||||
selectEditingId,
|
selectEditingId,
|
||||||
selectEditingScheduledId,
|
selectEditingScheduledId,
|
||||||
selectEditingMessage,
|
selectEditingMessage,
|
||||||
|
selectIsChatWithSelf,
|
||||||
} from '../../../global/selectors';
|
} from '../../../global/selectors';
|
||||||
import captureEscKeyListener from '../../../util/captureEscKeyListener';
|
import captureEscKeyListener from '../../../util/captureEscKeyListener';
|
||||||
import buildClassName from '../../../util/buildClassName';
|
import buildClassName from '../../../util/buildClassName';
|
||||||
@ -127,7 +128,6 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
currentUserId,
|
|
||||||
forwardMessages: { fromChatId, toChatId, messageIds: forwardMessageIds },
|
forwardMessages: { fromChatId, toChatId, messageIds: forwardMessageIds },
|
||||||
} = global;
|
} = global;
|
||||||
|
|
||||||
@ -150,18 +150,25 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
let sender: ApiChat | ApiUser | undefined;
|
let sender: ApiChat | ApiUser | undefined;
|
||||||
if (replyingToId && message) {
|
if (replyingToId && message) {
|
||||||
const { forwardInfo } = message;
|
const { forwardInfo } = message;
|
||||||
const isChatWithSelf = chatId === currentUserId;
|
const isChatWithSelf = selectIsChatWithSelf(global, chatId);
|
||||||
|
|
||||||
if (forwardInfo && (forwardInfo.isChannelPost || isChatWithSelf)) {
|
if (forwardInfo && (forwardInfo.isChannelPost || isChatWithSelf)) {
|
||||||
sender = selectForwardedSender(global, message);
|
sender = selectForwardedSender(global, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sender) {
|
if (!sender && !forwardInfo?.hiddenUserName) {
|
||||||
sender = selectSender(global, message);
|
sender = selectSender(global, message);
|
||||||
}
|
}
|
||||||
} else if (isForwarding) {
|
} else if (isForwarding) {
|
||||||
|
if (message) {
|
||||||
|
sender = selectForwardedSender(global, message);
|
||||||
|
if (!sender) {
|
||||||
|
sender = selectSender(global, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!sender) {
|
||||||
sender = isUserId(fromChatId!) ? selectUser(global, fromChatId!) : selectChat(global, fromChatId!);
|
sender = isUserId(fromChatId!) ? selectUser(global, fromChatId!) : selectChat(global, fromChatId!);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
replyingToId,
|
replyingToId,
|
||||||
|
Loading…
Reference in New Issue
Block a user