This commit is contained in:
commit
ad85b17c2a
2 changed files with 11 additions and 5 deletions
|
@ -41,7 +41,7 @@ export default function DeleteMessagesModal({
|
||||||
: i18n('icu:DeleteMessagesModal--deleteForMe'),
|
: i18n('icu:DeleteMessagesModal--deleteForMe'),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (canDeleteForEveryone) {
|
if (canDeleteForEveryone || isMe) {
|
||||||
const tooManyMessages = messageCount > MAX_DELETE_FOR_EVERYONE;
|
const tooManyMessages = messageCount > MAX_DELETE_FOR_EVERYONE;
|
||||||
actions.push({
|
actions.push({
|
||||||
'aria-disabled': tooManyMessages,
|
'aria-disabled': tooManyMessages,
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { __DEPRECATED$getMessageById } from '../messages/getMessageById';
|
||||||
import { getRecipientConversationIds } from './getRecipientConversationIds';
|
import { getRecipientConversationIds } from './getRecipientConversationIds';
|
||||||
import { getRecipients } from './getRecipients';
|
import { getRecipients } from './getRecipients';
|
||||||
import { repeat, zipObject } from './iterables';
|
import { repeat, zipObject } from './iterables';
|
||||||
|
import { isMe } from './whatTypeOfConversation';
|
||||||
|
|
||||||
export async function sendDeleteForEveryoneMessage(
|
export async function sendDeleteForEveryoneMessage(
|
||||||
conversationAttributes: ConversationAttributesType,
|
conversationAttributes: ConversationAttributesType,
|
||||||
|
@ -39,10 +40,15 @@ export async function sendDeleteForEveryoneMessage(
|
||||||
}
|
}
|
||||||
const idForLogging = getMessageIdForLogging(message.attributes);
|
const idForLogging = getMessageIdForLogging(message.attributes);
|
||||||
|
|
||||||
const timestamp = Date.now();
|
// If conversation is a Note To Self, no deletion time limits apply.
|
||||||
const maxDuration = deleteForEveryoneDuration || DAY;
|
if (!isMe(conversationAttributes)) {
|
||||||
if (timestamp - targetTimestamp > maxDuration) {
|
const timestamp = Date.now();
|
||||||
throw new Error(`Cannot send DOE for a message older than ${maxDuration}`);
|
const maxDuration = deleteForEveryoneDuration || DAY;
|
||||||
|
if (timestamp - targetTimestamp > maxDuration) {
|
||||||
|
throw new Error(
|
||||||
|
`Cannot send DOE for a message older than ${maxDuration}`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message.set({
|
message.set({
|
||||||
|
|
Loading…
Add table
Reference in a new issue