module-blog icon indicating copy to clipboard operation
module-blog copied to clipboard

Massdelete deletes all blogs when search has 1 result

Open PascalBrouwers opened this issue 3 years ago • 6 comments

Steps to reproduce

  • Go to All Posts
  • Use search so you have 1 result
  • check the blog and choose Delete

Expected result:

  • only 1 blog item deleted

Actual result:

  • all blog items deleted

PascalBrouwers avatar Jan 26 '21 10:01 PascalBrouwers

Fix in https://github.com/mirasvit/module-blog/pull/213

PascalBrouwers avatar Jan 26 '21 10:01 PascalBrouwers

@lrgmirasvit could you merge this PR https://github.com/mirasvit/module-blog/pull/213 ?

PascalBrouwers avatar Jan 28 '21 15:01 PascalBrouwers

@PascalBrouwers Thank you for submitting this fix. We'll check the fix and will merge this pull request after all the checks.

lrgmirasvit avatar Jan 29 '21 08:01 lrgmirasvit

@PascalBrouwers @lrgmirasvit I tested this fix but unfortunately I'm still able to reproduce the issue in the following way:

  • Open the blog listing in admin
  • Search by keyword in such a way that one blog post is listed
  • Select the listed blog post by checking the checkbox
  • Select the Delete action from the mass-action drop-down

I have not been able to reproduce the issue if I do a search using the filter dialog. As a temporary work-around I ended up adding a check to the mass delete controller so it will refuse to delete any blog posts if the collection contains more than one blog post.

stefangranit avatar Mar 01 '21 09:03 stefangranit

How is that a workaround? Now it's a bug that no blog posts gets deleted when you have 1 result from the search. My fix works, no idea why you can't reproduce it.

PascalBrouwers avatar Mar 01 '21 10:03 PascalBrouwers

True, safety-net is maybe a better term than workaround. I just needed to get a safety-net in place quickly as we do not want to end up with all blog posts getting deleted again by mistake. We have several hundreds of those and the information in those are critical in our case.

We're on Magento Commerce 2.4.1, and we updated the blog module early December last year. For some reason the fix did not help in our case. We'll have a look at this again later when we're on Magento 2.4.2.

stefangranit avatar Mar 01 '21 10:03 stefangranit