[commission]fix delete button bug with delay

This commit is contained in:
qcrao
2023-10-20 14:55:52 +08:00
parent 44336fa758
commit 0ccf1dbb39

View File

@@ -7,29 +7,10 @@ async function bulkDeleteConversations() {
return; return;
} }
for (let i = 0; i < selectedConversations.length; i++) {
const element = selectedConversations[i];
const deleteButton = element.querySelector(Selectors.deleteButton);
// If it is the first conversation and there is a delete button, skip it
if (i === 0 && deleteButton) {
console.log("Skipping first conversation due to existing delete button.");
continue;
}
// If it's not the first conversation but has a delete button, remove it
if (i !== 0 && deleteButton) {
console.log("delete the delete button.");
deleteButton.remove();
break;
}
}
console.log("Selected Conversations:", selectedConversations); console.log("Selected Conversations:", selectedConversations);
for (const element of selectedConversations) { for (const element of selectedConversations) {
await deleteConversation(element); await deleteConversation(element);
await delay(300);
} }
} }
@@ -47,6 +28,7 @@ async function deleteConversation(checkbox) {
console.log("1. Clicking conversation", conversationElement); console.log("1. Clicking conversation", conversationElement);
conversationElement.click(); conversationElement.click();
await delay(300);
const deleteButton = await waitForElement(Selectors.deleteButton); const deleteButton = await waitForElement(Selectors.deleteButton);