Use destroy_conditionally! helper for deletions in API

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

This is a follow-up to !22086 (merged): While fixing that I noticed some API endpoints are not using the destroy_conditionally! helper, when they probably should in order to gain support for the If-Unmodified-Since header.

Improvements

Use the destroy_conditionally! helper consistently for all deletion endpoints, passing a block where a custom deletion method is required.

Risks

This should not cause any problems for clients, since the behaviour will stay the same if they don't send a If-Unmodified-Since header. And if they do, these endpoints will now respect it.

Involved components

  • lib/api
  • ee/lib/api
Edited by 🤖 GitLab Bot 🤖