Adds keyboard shortcut for editing last message sent
This commit is contained in:
parent
a1fd4e55ee
commit
216ee67c50
13 changed files with 675 additions and 550 deletions
|
@ -68,7 +68,7 @@ import { isNotNil } from '../../util/isNotNil';
|
|||
import { isMoreRecentThan } from '../../util/timestamp';
|
||||
import * as iterables from '../../util/iterables';
|
||||
import { strictAssert } from '../../util/assert';
|
||||
import { canEditMessages } from '../../util/canEditMessages';
|
||||
import { canEditMessage } from '../../util/canEditMessage';
|
||||
|
||||
import { getAccountSelector } from './accounts';
|
||||
import {
|
||||
|
@ -130,7 +130,6 @@ import { getTitleNoDefault, getNumber } from '../../util/getTitle';
|
|||
|
||||
export { isIncoming, isOutgoing, isStory };
|
||||
|
||||
const MAX_EDIT_COUNT = 10;
|
||||
const THREE_HOURS = 3 * HOUR;
|
||||
const linkify = LinkifyIt();
|
||||
|
||||
|
@ -1822,18 +1821,6 @@ export function canRetryDeleteForEveryone(
|
|||
);
|
||||
}
|
||||
|
||||
export function canEditMessage(message: MessageWithUIFieldsType): boolean {
|
||||
return (
|
||||
canEditMessages() &&
|
||||
!message.deletedForEveryone &&
|
||||
isOutgoing(message) &&
|
||||
isMoreRecentThan(message.sent_at, THREE_HOURS) &&
|
||||
(message.editHistory?.length ?? 0) <= MAX_EDIT_COUNT &&
|
||||
someSendStatus(message.sendStateByConversationId, isSent) &&
|
||||
Boolean(message.body)
|
||||
);
|
||||
}
|
||||
|
||||
export function canDownload(
|
||||
message: MessageWithUIFieldsType,
|
||||
conversationSelector: GetConversationByIdType
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue