MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / handleDeleteOperation

Function handleDeleteOperation

src/core/webview/webviewMessageHandler.ts:249–275  ·  view source on GitHub ↗
(messageTs: number)

Source from the content-addressed store, hash-verified

247 * Handles message deletion operations with user confirmation
248 */
249 const handleDeleteOperation = async (messageTs: number): Promise<void> => {
250 // Check if there's a checkpoint before this message
251 const currentCline = provider.getCurrentTask()
252 let hasCheckpoint = false
253
254 if (!currentCline) {
255 await vscode.window.showErrorMessage(t("common:errors.message.no_active_task_to_delete"))
256 return
257 }
258
259 const { messageIndex } = findMessageIndices(messageTs, currentCline)
260
261 if (messageIndex !== -1) {
262 // Find the last checkpoint before this message
263 const checkpoints = currentCline.clineMessages.filter(
264 (msg) => msg.say === "checkpoint_saved" && msg.ts > messageTs,
265 )
266 hasCheckpoint = checkpoints.length > 0
267 }
268
269 // Send message to webview to show delete confirmation dialog
270 await provider.postMessageToWebview({
271 type: "showDeleteMessageDialog",
272 messageTs,
273 hasCheckpoint,
274 })
275 }
276
277 /**
278 * Handles confirmed message deletion from webview dialog

Callers 1

Calls 5

tFunction · 0.90
findMessageIndicesFunction · 0.85
postMessageToWebviewMethod · 0.80
getCurrentTaskMethod · 0.65
showErrorMessageMethod · 0.45

Tested by

no test coverage detected