Skip to content

[6.0] [webservices] cannot delete not trashed resource return 409#45868

Merged
Bodge-IT merged 20 commits intojoomla:6.0-devfrom
alikon:patch-26
Sep 8, 2025
Merged

[6.0] [webservices] cannot delete not trashed resource return 409#45868
Bodge-IT merged 20 commits intojoomla:6.0-devfrom
alikon:patch-26

Conversation

@alikon
Copy link
Contributor

@alikon alikon commented Aug 7, 2025

Pull Request for Issue #45590 .

Summary of Changes

return HTTP status code 409 instead of 500
add a system test

Testing Instructions

delete not-trashed resource like: tag, category, article etc via webservices DELETE endpoint

Actual result BEFORE applying this Pull Request

HTTP status code 500 and error message "Internal server error".

Expected result AFTER applying this Pull Request

HTTP status code 409 with informative message like : Resource not in state that can be deleted, must be trashed before it can be deleted

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@alikon alikon changed the title Draft cannot delete not trashed banner test [WIP][webservices] cannot delete not trashed resource return 409 Aug 7, 2025
@alikon alikon changed the title [WIP][webservices] cannot delete not trashed resource return 409 [WIP][webservices] cannot not trashed resource return 409 Aug 7, 2025
@alikon alikon changed the title [WIP][webservices] cannot not trashed resource return 409 [WIP][webservices] cannot delete not trashed resource return 409 Aug 7, 2025
@alikon alikon changed the title [WIP][webservices] cannot delete not trashed resource return 409 [6.0][webservices] cannot delete not trashed resource return 409 Aug 8, 2025
@alikon alikon marked this pull request as ready for review August 8, 2025 10:25
@exlemor
Copy link

exlemor commented Aug 8, 2025

I have tested this item ✅ successfully on 9b475e6

I have tested this successfully via Postman! Thanks @alikon (and I confirmed that if you do Trash the article, if does DELETE it as well).


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45868.

@bembelimen bembelimen added the bug label Aug 20, 2025
@alikon alikon added the PBF Pizza, Bugs and Fun label Aug 22, 2025
@rbuelund
Copy link

I have tested this item ✅ successfully on 4fbb57e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45868.

@exlemor
Copy link

exlemor commented Aug 24, 2025

I have tested this item ✅ successfully on 4fbb57e

I have re-tested this successfully ! Thanks @alikon

Same positive results :D


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45868.

@richard67
Copy link
Member

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45868.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 25, 2025
@richard67
Copy link
Member

I've allowed myself to fix the conflict in the ApiController.php file. It was caused by the same line of code being removed with this PR here and with PR #45589 on the 5.3-dev branch. As this did not change anything on the code, RTC is still valid.

@richard67
Copy link
Member

@alikon Since the last branch update, system tests are failing for this PR here:

  Running:  api/com_contact/Contacts.cy.js                                              (103 of 148)

  Test that contacts API endpoint
    ✓ can deliver a list of contacts (947ms)
    ✓ can deliver a single contact (97ms)
    ✓ can create a contact (120ms)
    ✓ can update a contact (158ms)
    ✓ can delete a contact (94ms)
    1) check correct response for delete a not existent contact
    ✓ can submit a contact form (291ms)

  6 passing (2s)
  1 failing

  1) Test that contacts API endpoint
       check correct response for delete a not existent contact:
     CypressError: `cy.request()` failed on:

https://localhost/cmysql/api/index.php/v1/contacts/9999
The response we received from your web server was:
  > 500: Internal Server Error

Did I do something wrong when resolving the conflict caused by the upmerged PR #45589 ?

@HLeithner HLeithner changed the title [6.0][webservices] cannot delete not trashed resource return 409 [6.0] [webservices] cannot delete not trashed resource return 409 Aug 31, 2025
@alikon
Copy link
Contributor Author

alikon commented Sep 7, 2025

@richard67 all system tests are successful now

@Bodge-IT Bodge-IT merged commit bda0a28 into joomla:6.0-dev Sep 8, 2025
30 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Sep 8, 2025
@Bodge-IT
Copy link
Contributor

Bodge-IT commented Sep 8, 2025

Great work @alikon, thank you. Big thanks to @exlemor & @rbuelund for the tests

@muhme
Copy link
Contributor

muhme commented Sep 14, 2025

Sorry for being late, it has been very busy days ... but I was of course, I am interested to see the fix of my issue 😄

Tested with JBT graft nightly builds and api_500_test.sh:

  • for 5.3.4-dev, 5.4.0-dev and 6.0.0-beta2 (as the PR is already merged)
    • ❌ Deleting not-trashed article/content category/tag > 204 (NO CONTENT), but the action failed
    • ✅ Deleting trashed article/content category/tag > 204 (NO CONTENT)
    • ✅ Deleting not-existing article/content category/tag > 204 (NO CONTENT)
  • for 6.0.0-dev
    • ✅ Deleting not-trashed article > 409 (CONFLICT), but the API call failed
      • data.message: Resource not in state that can be deleted, must be trashed before it can be deleted
      • messages.warning: Delete not permitted.
    • ✅ Deleting trashed article/content category/tag > 204 (NO CONTENT)
    • ✅ Deleting not-existing article/content category/tag > 204 (NO CONTENT)

Before the PR and tested from 5.3 onwards, deleting an not-trashed item no longer results in a 500, but still results in a wrong 204. This is fixed well 👍

Created #46095

Thank you for extending System Tests with testing to delete not-trashed and not-existing banner 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

Comments