Fix replying in discussions (#1954)
This commit is contained in:
parent
9b3050d179
commit
5581b2b421
@ -1147,6 +1147,7 @@ export function buildLocalMessage(
|
|||||||
text?: string,
|
text?: string,
|
||||||
entities?: ApiMessageEntity[],
|
entities?: ApiMessageEntity[],
|
||||||
replyingTo?: number,
|
replyingTo?: number,
|
||||||
|
replyingToTopId?: number,
|
||||||
attachment?: ApiAttachment,
|
attachment?: ApiAttachment,
|
||||||
sticker?: ApiSticker,
|
sticker?: ApiSticker,
|
||||||
gif?: ApiVideo,
|
gif?: ApiVideo,
|
||||||
@ -1181,6 +1182,7 @@ export function buildLocalMessage(
|
|||||||
isOutgoing: !isChannel,
|
isOutgoing: !isChannel,
|
||||||
senderId: sendAs?.id || currentUserId,
|
senderId: sendAs?.id || currentUserId,
|
||||||
...(replyingTo && { replyToMessageId: replyingTo }),
|
...(replyingTo && { replyToMessageId: replyingTo }),
|
||||||
|
...(replyingToTopId && { replyToTopMessageId: replyingToTopId }),
|
||||||
...(groupedId && {
|
...(groupedId && {
|
||||||
groupedId,
|
groupedId,
|
||||||
...(media && (media.photo || media.video) && { isInAlbum: true }),
|
...(media && (media.photo || media.video) && { isInAlbum: true }),
|
||||||
|
|||||||
@ -202,6 +202,7 @@ export function sendMessage(
|
|||||||
text,
|
text,
|
||||||
entities,
|
entities,
|
||||||
replyingTo,
|
replyingTo,
|
||||||
|
replyingToTopId,
|
||||||
attachment,
|
attachment,
|
||||||
sticker,
|
sticker,
|
||||||
gif,
|
gif,
|
||||||
@ -218,6 +219,7 @@ export function sendMessage(
|
|||||||
text?: string;
|
text?: string;
|
||||||
entities?: ApiMessageEntity[];
|
entities?: ApiMessageEntity[];
|
||||||
replyingTo?: number;
|
replyingTo?: number;
|
||||||
|
replyingToTopId?: number;
|
||||||
attachment?: ApiAttachment;
|
attachment?: ApiAttachment;
|
||||||
sticker?: ApiSticker;
|
sticker?: ApiSticker;
|
||||||
gif?: ApiVideo;
|
gif?: ApiVideo;
|
||||||
@ -237,6 +239,7 @@ export function sendMessage(
|
|||||||
text,
|
text,
|
||||||
entities,
|
entities,
|
||||||
replyingTo,
|
replyingTo,
|
||||||
|
replyingToTopId,
|
||||||
attachment,
|
attachment,
|
||||||
sticker,
|
sticker,
|
||||||
gif,
|
gif,
|
||||||
|
|||||||
@ -912,6 +912,7 @@ async function sendMessage(params: {
|
|||||||
isSilent?: boolean;
|
isSilent?: boolean;
|
||||||
scheduledAt?: number;
|
scheduledAt?: number;
|
||||||
sendAs?: ApiChat | ApiUser;
|
sendAs?: ApiChat | ApiUser;
|
||||||
|
replyingToTopId?: number;
|
||||||
}) {
|
}) {
|
||||||
let localId: number | undefined;
|
let localId: number | undefined;
|
||||||
const progressCallback = params.attachment ? (progress: number, messageLocalId: number) => {
|
const progressCallback = params.attachment ? (progress: number, messageLocalId: number) => {
|
||||||
@ -950,6 +951,10 @@ async function sendMessage(params: {
|
|||||||
params.replyingTo = selectThreadTopMessageId(global, params.chat.id, threadId)!;
|
params.replyingTo = selectThreadTopMessageId(global, params.chat.id, threadId)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.replyingTo && !params.replyingToTopId && threadId !== MAIN_THREAD_ID) {
|
||||||
|
params.replyingToTopId = selectThreadTopMessageId(global, params.chat.id, threadId)!;
|
||||||
|
}
|
||||||
|
|
||||||
await callApi('sendMessage', params, progressCallback);
|
await callApi('sendMessage', params, progressCallback);
|
||||||
|
|
||||||
if (progressCallback && localId) {
|
if (progressCallback && localId) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user