Composer: Fix error when opening chat with read-only restriction (again) (#2044)

This commit is contained in:
Alexander Zinchuk 2022-09-20 14:59:12 +02:00
parent 58d8242d17
commit 923c3ee12e
2 changed files with 18 additions and 7 deletions

View File

@ -734,12 +734,17 @@ export async function sendMessageAction({
return undefined; return undefined;
} }
const result = await invokeRequest(new GramJs.messages.SetTyping({ try {
peer: buildInputPeer(peer.id, peer.accessHash), const result = await invokeRequest(new GramJs.messages.SetTyping({
topMsgId: threadId, peer: buildInputPeer(peer.id, peer.accessHash),
action: gramAction, topMsgId: threadId,
})); action: gramAction,
return result; }), undefined, true);
return result;
} catch (error) {
// Prevent error from being displayed in UI
}
return undefined;
} }
export async function markMessageListRead({ export async function markMessageListRead({

View File

@ -75,7 +75,9 @@ import {
import { import {
debounce, onTickEnd, rafPromise, debounce, onTickEnd, rafPromise,
} from '../../../util/schedulers'; } from '../../../util/schedulers';
import { getMessageOriginalId, getUserFullName, isServiceNotificationMessage } from '../../helpers'; import {
getMessageOriginalId, getUserFullName, isDeletedUser, isServiceNotificationMessage, isUserBot,
} from '../../helpers';
import { getTranslation } from '../../../util/langProvider'; import { getTranslation } from '../../../util/langProvider';
import { ensureProtocol } from '../../../util/ensureProtocol'; import { ensureProtocol } from '../../../util/ensureProtocol';
@ -332,6 +334,8 @@ addActionHandler('saveDraft', (global, actions, payload) => {
const { text, entities } = draft; const { text, entities } = draft;
const chat = selectChat(global, chatId)!; const chat = selectChat(global, chatId)!;
const user = selectUser(global, chatId)!;
if (user && isDeletedUser(user)) return undefined;
if (threadId === MAIN_THREAD_ID) { if (threadId === MAIN_THREAD_ID) {
void callApi('saveDraft', { void callApi('saveDraft', {
@ -484,6 +488,8 @@ addActionHandler('sendMessageAction', async (global, actions, payload) => {
const chat = selectChat(global, chatId)!; const chat = selectChat(global, chatId)!;
if (!chat) return; if (!chat) return;
const user = selectUser(global, chatId);
if (user && (isUserBot(user) || isDeletedUser(user))) return;
await callApi('sendMessageAction', { await callApi('sendMessageAction', {
peer: chat, threadId, action, peer: chat, threadId, action,