mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-03 18:17:59 +01:00
Message: Fix delete and edit actions for admins (#1293)
This commit is contained in:
parent
2497488eec
commit
7c275da3f8
@ -356,8 +356,12 @@ export function selectAllowedMessageActions(global: GlobalState, message: ApiMes
|
||||
const isOwn = isOwnMessage(message);
|
||||
const isAction = isActionMessage(message);
|
||||
const { content } = message;
|
||||
const canEditMessagesIndefinitely = isChatWithSelf
|
||||
|| (isSuperGroup && getHasAdminRight(chat, 'pinMessages'))
|
||||
|| (isChannel && getHasAdminRight(chat, 'editMessages'));
|
||||
const isMessageEditable = (
|
||||
(isChatWithSelf || Date.now() + serverTimeOffset * 1000 - message.date * 1000 < MESSAGE_EDIT_ALLOWED_TIME_MS)
|
||||
(canEditMessagesIndefinitely
|
||||
|| Date.now() + serverTimeOffset * 1000 - message.date * 1000 < MESSAGE_EDIT_ALLOWED_TIME_MS)
|
||||
&& !(
|
||||
content.sticker || content.contact || content.poll || content.action || content.audio
|
||||
|| (content.video && content.video.isRound)
|
||||
@ -395,7 +399,7 @@ export function selectAllowedMessageActions(global: GlobalState, message: ApiMes
|
||||
const canDeleteForAll = canDelete && !isServiceNotification && (
|
||||
(isPrivate && !isChatWithSelf)
|
||||
|| (isBasicGroup && (
|
||||
isOwn || getHasAdminRight(chat, 'deleteMessages')
|
||||
isOwn || getHasAdminRight(chat, 'deleteMessages') || chat.isCreator
|
||||
))
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user