From 1a8c3b71bbfaeb195a7f402458b6b68b0ccea7ef Mon Sep 17 00:00:00 2001 From: Krzysztof Tajchman <38138485+Minitajfun@users.noreply.github.com> Date: Thu, 6 Aug 2026 03:36:49 +0200 Subject: [PATCH 1/2] ReplaceGoogleSearch: add Kagi (#4476) --- src/plugins/replaceGoogleSearch/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/replaceGoogleSearch/index.tsx b/src/plugins/replaceGoogleSearch/index.tsx index b8ccfa705..223a2dd0f 100644 --- a/src/plugins/replaceGoogleSearch/index.tsx +++ b/src/plugins/replaceGoogleSearch/index.tsx @@ -21,7 +21,8 @@ const DefaultEngines = { GitHub: "https://github.com/search?q=", Reddit: "https://www.reddit.com/search?q=", Wikipedia: "https://wikipedia.org/w/index.php?search=", - Startpage: "https://www.startpage.com/sp/search?query=" + Startpage: "https://www.startpage.com/sp/search?query=", + Kagi: "https://kagi.com/search?q=" } as const; const enum ReplacementEngineValue { From 4af36e5723a6a2ae62e5b0cbf134e49332229ff0 Mon Sep 17 00:00:00 2001 From: sadan <117494111+sadan4@users.noreply.github.com> Date: Thu, 6 Aug 2026 08:51:51 -0400 Subject: [PATCH 2/2] MessageLogger: fix attachment handling when clearing history (#4493) --- src/plugins/messageLogger/index.tsx | 61 +++++++++++++++++------------ 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index aa1fcb978..18a4a0d0e 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -127,11 +127,43 @@ function addDeleteStyle() { const REMOVE_HISTORY_ID = "ml-remove-history"; const TOGGLE_DELETE_STYLE_ID = "ml-toggle-style"; + +/** + * Clears a message's history (edit + attachments) + * + * if the message was deleted, it will be completely removed from the UI and MessageStore + */ +function clearMessageHistory(msg: MLMessage) { + if (msg.deleted) { + FluxDispatcher.dispatch({ + type: "MESSAGE_DELETE", + channelId: msg.channel_id, + messageId: msg.id, + mlDeleted: true + }); + } else { + const attachments = msg.attachments?.filter((a: MLAttachment) => !a.deleted); + + updateMessage(msg.channel_id, msg.id, { editHistory: [], attachments }); + } +} + +/** + * checks if a message has any history (deleted or edited) + * @param message the message to check + * + * @returns true if the message has any history, false otherwise + */ +function doesMessageHaveHistory(message: MLMessage): boolean { + return message.deleted || !!message.editHistory?.length || message.attachments?.some((a: MLAttachment) => a.deleted); + +} + const patchMessageContextMenu: NavContextMenuPatchCallback = (children, props) => { const { message } = props; - const { deleted, editHistory, id, channel_id } = message; + const { deleted, id, channel_id } = message; - if (!deleted && !editHistory?.length) return; + if (!doesMessageHaveHistory(message)) return; toggle: { if (!deleted) break toggle; @@ -156,16 +188,7 @@ const patchMessageContextMenu: NavContextMenuPatchCallback = (children, props) = label="Remove Message History" color="danger" action={() => { - if (deleted) { - FluxDispatcher.dispatch({ - type: "MESSAGE_DELETE", - channelId: channel_id, - id, - mlDeleted: true - }); - } else { - updateMessage(channel_id, id, { editHistory: [] }); - } + clearMessageHistory(message); }} /> )); @@ -173,7 +196,7 @@ const patchMessageContextMenu: NavContextMenuPatchCallback = (children, props) = const patchChannelContextMenu: NavContextMenuPatchCallback = (children, { channel }) => { const messages = MessageStore.getMessages(channel?.id) as MLMessage[]; - if (!messages?.some(msg => msg.deleted || msg.editHistory?.length)) return; + if (!messages?.some(msg => doesMessageHaveHistory(msg))) return; const group = findGroupChildrenByChildId("mark-channel-read", children) ?? children; group.push( @@ -183,17 +206,7 @@ const patchChannelContextMenu: NavContextMenuPatchCallback = (children, { channe color="danger" action={() => { messages.forEach(msg => { - if (msg.deleted) - FluxDispatcher.dispatch({ - type: "MESSAGE_DELETE", - channelId: channel.id, - id: msg.id, - mlDeleted: true - }); - else - updateMessage(channel.id, msg.id, { - editHistory: [] - }); + clearMessageHistory(msg); }); }} />