Last active
May 9, 2026 11:27
-
-
Save ivan/3a98faa747d686567ed858bffe60a490 to your computer and use it in GitHub Desktop.
Edit messages over a day old in Signal-Desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/_locales/en/messages.json b/_locales/en/messages.json | |
| index cbcdc7e4b..1ecc92256 100644 | |
| --- a/_locales/en/messages.json | |
| +++ b/_locales/en/messages.json | |
| @@ -3353,7 +3353,7 @@ | |
| "description": "Toast shown when view once mode is disabled for a message" | |
| }, | |
| "icu:ToastManager__CannotEditMessage_24": { | |
| - "messageformat": "Edits can only be applied within 24 hours from the time you sent this message.", | |
| + "messageformat": "Edits can only be applied within about 48 hours from the time you sent this message.", | |
| "description": "Error message when you try to send an edit after message becomes too old" | |
| }, | |
| "icu:startConversation--username-not-found": { | |
| diff --git a/ts/util/canEditMessage.dom.ts b/ts/util/canEditMessage.dom.ts | |
| index a16a08d37..8493d19ff 100644 | |
| --- a/ts/util/canEditMessage.dom.ts | |
| +++ b/ts/util/canEditMessage.dom.ts | |
| @@ -2,7 +2,7 @@ | |
| // SPDX-License-Identifier: AGPL-3.0-only | |
| import type { ReadonlyMessageAttributesType } from '../model-types.d.ts'; | |
| -import { DAY } from './durations/index.std.ts'; | |
| +import { DAY, MINUTE } from './durations/index.std.ts'; | |
| import { isMoreRecentThan } from './timestamp.std.ts'; | |
| import { isOutgoing, isPoll } from '../messages/helpers.std.ts'; | |
| import { isMessageNoteToSelf } from './isMessageNoteToSelf.dom.ts'; | |
| @@ -12,12 +12,15 @@ export const MESSAGE_MAX_EDIT_COUNT = 10; | |
| export function canEditMessage( | |
| message: ReadonlyMessageAttributesType | |
| ): boolean { | |
| + // Hacked-up Signal-Desktop: the limit on the receiving end (`isTooOldToEditMessage`) is | |
| + // DAY * 2, so instead of the stock `DAY`, use `DAY * 2` here as well, minus one minute. | |
| + const maxAge = DAY * 2 - MINUTE; | |
| return ( | |
| !message.sms && | |
| !message.deletedForEveryone && | |
| isOutgoing(message) && | |
| !isPoll(message) && | |
| - (isMoreRecentThan(message.sent_at, DAY) || isMessageNoteToSelf(message)) && | |
| + (isMoreRecentThan(message.sent_at, maxAge) || isMessageNoteToSelf(message)) && | |
| Boolean(message.body) | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment