# Bug OP-1967 - [WP list] Deleting global queries not possible (bad request)

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-1967

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 4.1.2 |
| Observed in versions |  |
| Sprint | 4.1.2 |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

**Preconditions**

  - Work package module activated.
  - Global query exists.

**Steps to reproduce**

1.  Go to global query.
2.  Delete global query.

**Actual behavior**

  - Error message “Bad request” is displayed and deleting query not possible.

**Expected behavior**

  - Query can be deleted.

**Hints for the solution**

  - It seems to be a problem with the Angular router. The url that gets called is `api/experimental/projects/null/queries...`. So the `project_id=nil` just gets translated to the project with the id `null`. 
  - The before filter `find_optional_project` looks for the project of the query (if there is one) and looks if the user has the right to perform the action. This rescues the `ActiveRecord::NotFound` (because no project with ) and renders 404

**Screenshot**  
![](Capture.png)

**QA system**

  - enterprise-4-0.qa.finn.de
  - org-4.0.10
  - org-4-1.qa.finn.de
  - OpenProject 4.1.0
