Api Update: Fix messages sync (#5840)
This commit is contained in:
parent
58e79daddb
commit
ec66c16f21
@ -175,6 +175,7 @@ export function updater(update: Update) {
|
||||
message,
|
||||
shouldForceReply,
|
||||
poll,
|
||||
shouldCreateMessageIfNeeded: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -233,6 +233,8 @@ export type ApiUpdateMessage = {
|
||||
id: number;
|
||||
message: Partial<ApiMessage>;
|
||||
poll?: ApiPoll;
|
||||
shouldForceReply?: boolean;
|
||||
shouldCreateMessageIfNeeded?: true;
|
||||
};
|
||||
|
||||
export type ApiUpdateScheduledMessage = {
|
||||
|
||||
@ -256,10 +256,23 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
||||
|
||||
case 'updateMessage': {
|
||||
const {
|
||||
chatId, id, message, poll,
|
||||
chatId, id, message, poll, shouldCreateMessageIfNeeded, shouldForceReply,
|
||||
} = update;
|
||||
|
||||
const currentMessage = selectChatMessage(global, chatId, id);
|
||||
|
||||
if (shouldCreateMessageIfNeeded && !currentMessage) {
|
||||
actions.apiUpdate({
|
||||
'@type': 'newMessage',
|
||||
id: update.id,
|
||||
chatId: update.chatId,
|
||||
message: update.message,
|
||||
poll: update.poll,
|
||||
shouldForceReply,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const chat = selectChat(global, chatId);
|
||||
|
||||
global = updateWithLocalMedia(global, chatId, id, message);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user