Skip to content

Commit

Permalink
add context menu option to delete media-messages from gallery
Browse files Browse the repository at this point in the history
"delete message from gallery" was mentioned in deltachat/interface#39
  • Loading branch information
Simon-Laux committed Sep 14, 2023
1 parent b652e46 commit 4800e66
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Show thumbnail in chatlist summary of image, sticker and webxdc messages
- add webxdc api `sendToChat` #3240
- add webxdc api `importFiles`
- add context menu option to delete media-messages from gallery

### Changed
- exclude more unused files from installation package
Expand Down
23 changes: 21 additions & 2 deletions src/renderer/components/attachment/mediaAttachment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
openAttachmentInShell,
onDownload,
openWebxdc,
confirmDeleteMessage,
} from '../message/messageFunctions'
import { ScreenContext, unwrapContext } from '../../contexts'
import {
Expand All @@ -18,11 +19,12 @@ import { OpenDialogFunctionType } from '../dialogs/DialogController'
import { runtime } from '../../runtime'

import filesizeConverter from 'filesize'
import { jumpToMessage } from '../helpers/ChatMethods'
import { deleteMessage, jumpToMessage } from '../helpers/ChatMethods'
import { getLogger } from '../../../shared/logger'
import { truncateText } from '../../../shared/util'
import { Type } from '../../backend-com'
import { selectedAccountId } from '../../ScreenController'
import ConfirmationDialog from '../dialogs/ConfirmationDialog'

const log = getLogger('mediaAttachment')

Expand Down Expand Up @@ -69,6 +71,15 @@ const contextMenuFactory = (
label: tx('menu_message_details'),
action: openDialog.bind(null, 'MessageDetail', { id: msgId }),
},
{
label: tx('delete'),
action: () =>
openDialog(ConfirmationDialog, {
message: tx('ask_delete_message'),
confirmLabel: tx('delete'),
cb: (yes: boolean) => yes && deleteMessage(msgId),
}),
},
]
}

Expand Down Expand Up @@ -97,7 +108,15 @@ function getBrokenMediaContextMenu(
const tx = window.static_translate
return makeContextMenu(
[

{
label: tx('delete'),
action: () =>
openDialog(ConfirmationDialog, {
message: tx('ask_delete_message'),
confirmLabel: tx('delete'),
cb: (yes: boolean) => yes && deleteMessage(msgId),
}),
},
],
openContextMenu
)
Expand Down

0 comments on commit 4800e66

Please sign in to comment.