mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-12 09:09:45 +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 isOwn = isOwnMessage(message);
|
||||||
const isAction = isActionMessage(message);
|
const isAction = isActionMessage(message);
|
||||||
const { content } = message;
|
const { content } = message;
|
||||||
|
const canEditMessagesIndefinitely = isChatWithSelf
|
||||||
|
|| (isSuperGroup && getHasAdminRight(chat, 'pinMessages'))
|
||||||
|
|| (isChannel && getHasAdminRight(chat, 'editMessages'));
|
||||||
const isMessageEditable = (
|
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.sticker || content.contact || content.poll || content.action || content.audio
|
||||||
|| (content.video && content.video.isRound)
|
|| (content.video && content.video.isRound)
|
||||||
@ -395,7 +399,7 @@ export function selectAllowedMessageActions(global: GlobalState, message: ApiMes
|
|||||||
const canDeleteForAll = canDelete && !isServiceNotification && (
|
const canDeleteForAll = canDelete && !isServiceNotification && (
|
||||||
(isPrivate && !isChatWithSelf)
|
(isPrivate && !isChatWithSelf)
|
||||||
|| (isBasicGroup && (
|
|| (isBasicGroup && (
|
||||||
isOwn || getHasAdminRight(chat, 'deleteMessages')
|
isOwn || getHasAdminRight(chat, 'deleteMessages') || chat.isCreator
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user