diff --git a/lib/utils/delete-message-utils.js b/lib/utils/delete-message-utils.js --- a/lib/utils/delete-message-utils.js +++ b/lib/utils/delete-message-utils.js @@ -21,7 +21,10 @@ import { isComposableMessageType } from '../types/message-types.js'; import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; -import { thickThreadTypes } from '../types/thread-types-enum.js'; +import { + thickThreadTypes, + threadTypeIsThick, +} from '../types/thread-types-enum.js'; const deletedMessageText = 'Deleted message'; @@ -110,6 +113,16 @@ return true; } + if ( + threadTypeIsThick(threadInfo.type) && + targetMessageInfo.time < threadInfo.creationTime + ) { + // This code blocks deleting a sidebar source in thick threads - we + // don't handle it correctly now. We have a task to track + // https://linear.app/comm/issue/ENG-10528/handle-message-edit-and-delete-of-a-sidebar-source-in-thick-threads + return false; + } + return ( currentUserInfo.id === targetMessageInfo.creator.id && canDeleteOwnMessages ); diff --git a/web/tooltips/tooltip-action-utils.js b/web/tooltips/tooltip-action-utils.js --- a/web/tooltips/tooltip-action-utils.js +++ b/web/tooltips/tooltip-action-utils.js @@ -427,18 +427,12 @@ const togglePinAction = useMessageTogglePinAction(item, threadInfo); const editAction = useMessageEditAction(item, threadInfo); const deleteAction = useMessageDeleteAction(item, threadInfo); - return React.useMemo( - () => - [ - replyAction, - sidebarAction, - copyAction, - reactAction, - togglePinAction, - editAction, - deleteAction, - ].filter(Boolean), - [ + + return React.useMemo(() => { + if (item.deleted) { + return []; + } + return [ replyAction, sidebarAction, copyAction, @@ -446,8 +440,17 @@ togglePinAction, editAction, deleteAction, - ], - ); + ].filter(Boolean); + }, [ + item.deleted, + replyAction, + sidebarAction, + copyAction, + reactAction, + togglePinAction, + editAction, + deleteAction, + ]); } const undefinedTooltipSize = {