Title delete button for queries does not work
Priority bug Status resolved
Superseder Nosy List berker.peksag, brett.cannon, eric.araujo, ezio.melotti, loewis, meador.inge, ncoghlan, r.david.murray, ralph.corderoy
Assigned To Topics

Created on 2010-08-13.12:19:43 by r.david.murray, last changed 2014-03-05.22:19:08 by r.david.murray.

msg1787 (view) Author: r.david.murray Date: 2010-08-13.12:19:42
I have several private queries, and I'd like to delete some of them (some are duplicates...not sure how those got created).  If I click 'delete', I get a red bar at the top that says "invalid request".
msg1788 (view) Author: brett.cannon Date: 2010-08-13.18:44:37
Happening to me to. Doesn't get fixed if I select to not have them listed first either.
msg1789 (view) Author: ezio.melotti Date: 2010-08-13.19:10:45
Same here. I think it's a bug in Roundup and it should be reported upstream.
FWIW if you go here and you have enough permissions to see it, you can delete the query manually, but on my instance I get "You do not have permission to retire query", so probably I need even higher privileges.
I guess that someone (Martin) could delete some of the queries on request, but it would be better to get this fixed.
msg1790 (view) Author: loewis Date: 2010-08-14.08:46:13
It's a bug in the python-dev instance. It uses a GET on retire, yet the CSRF protection requires it to be a POST. Most likely, the instance needs to be updated to match the template.
msg1791 (view) Author: ezio.melotti Date: 2010-08-14.09:52:29
I looked at this and found out that the delete button calls a Javascript function that redirects to "queryXX?@action=retire&@template=edit".
The problem with POST requests is that queryXX has to be specified in the action="" of the form, so -- unless I'm missing something -- the possible solutions are:
 1) create a different form for each query;
 2) send the request to something like "query?@action=retire&@template=edit&id=XX" and handle it server-side;

The latter might require a new action/extension (unless there's already a way to pass the id in that way).
msg1792 (view) Author: ezio.melotti Date: 2010-08-14.10:03:31
I was also thinking to remove the "Delete" buttons from the table and add at the bottom of the page (under "New query name") something like:
New query name: [______________] [Add]
Delete query: [____________[▼] [Delete]
msg1912 (view) Author: eric.araujo Date: 2011-02-11.17:50:31
Can you test deleting a query without JavaScript enabled?
msg1913 (view) Author: r.david.murray Date: 2011-02-11.18:33:19
With javascript disabled, nothing happens when the delete button is pressed.
msg2245 (view) Author: meador.inge Date: 2011-09-12.03:26:23
Did this ever get fixed?  Are there any workarounds?  I am trying to clean out some old filters and can't.
msg2246 (view) Author: loewis Date: 2011-09-12.06:10:19
> Did this ever get fixed?  Are there any workarounds?

As a work-around, post the list of query IDs to this issue,
and I'll try to retire them.
msg2247 (view) Author: meador.inge Date: 2011-09-18.23:48:39
Here are the IDs for items on "My Queries" that I would like

   * 4 (Patches)
   * 53 (Easy Tasks)
   * 154 (Crashers)
   * 273 (Performance)
   * 387 (Core Patches)
   * 388 (Core Needs Patch)
   * 426 (Nosy On)
msg2248 (view) Author: ezio.melotti Date: 2011-09-19.12:33:49
There seem to be two issues here:

1) The request needs to be submit via post, and the current js workaround uses get.  The whole table to edit queries is in a form, with action="query".  The "delete" request must be sent to queryXX (where XX is the id of the query to be deleted), therefore every delete button needs its own form with a different action="queryXX" (unless we want to use js to change the action when the user hits "delete").  These forms can't be nested inside the main form, so all the delete buttons should be moved outside (or maybe in a separate query.delete.html page);

2) permission for retiring/deleting the query are not set in the schema, so even when a post request is sent to queryXX, Roundup complains with "You do not have permission to retire query".  Adding
+p ='Retire', klass='query', check=edit_query,
+    description="User is allowed to retire their queries")
+for r in 'User', 'Developer', 'Coordinator':
+, p)
seems to address this problem.

When these two problems are addressed, retiring queries works, but there are a few remaining problems:
1) when a query is retired it should also be hidden from the menu, otherwise it will still be listed under "your queries";
2) we should decide where to put all the delete buttons or come up with some better design;
3) we might allow coordinators to retire any query too.
msg2287 (view) Author: ezio.melotti Date: 2011-10-20.20:37:20
I closed issue160 because the problem mentioned there will most likely get fixed once this issue gets fixed.
msg2733 (view) Author: ncoghlan Date: 2013-05-07.13:19:18
This hit me as well (because rerunning a query with the same name in the saved field creates a new copy rather than overwriting the original). Potentially related is the fact that in addition to delete not working, the dropdowns don't let me change the query state (I get a permission error when I hit "Save Selection").
msg2835 (view) Author: r.david.murray Date: 2014-03-05.17:50:32
The leave in/out dropdown is a different problem.  I've fixed that one today.
msg2836 (view) Author: r.david.murray Date: 2014-03-05.19:47:59
Also fixed the public yes/no dropdown, which had yet a different bug :(.
msg2837 (view) Author: r.david.murray Date: 2014-03-05.22:19:07
Delete is fixed, at least for most browsers.  There are probably some where the javascript I used won't work.
Date User Action Args
2014-03-05 22:19:08r.david.murraysetstatus: chatting -> resolved
messages: + msg2837
2014-03-05 19:47:59r.david.murraysetmessages: + msg2836
2014-03-05 17:50:33r.david.murraysetmessages: + msg2835
2013-05-07 13:19:19ncoghlansetnosy: + ncoghlan
messages: + msg2733
2013-04-06 16:03:49berker.peksagsetnosy: + berker.peksag
2012-05-29 08:55:00ralph.corderoysetnosy: + ralph.corderoy
2011-10-20 20:37:20ezio.melottisetmessages: + msg2287
2011-09-19 12:33:49ezio.melottisetmessages: + msg2248
2011-09-18 23:48:39meador.ingesetmessages: + msg2247
2011-09-12 06:10:19loewissetmessages: + msg2246
2011-09-12 03:26:23meador.ingesetnosy: + meador.inge
messages: + msg2245
2011-02-11 18:33:19r.david.murraysetmessages: + msg1913
2011-02-11 17:50:31eric.araujosetnosy: + eric.araujo
messages: + msg1912
2010-08-14 10:03:31ezio.melottisetmessages: + msg1792
2010-08-14 09:52:30ezio.melottisetmessages: + msg1791
2010-08-14 08:46:14loewissetmessages: + msg1790
2010-08-13 19:10:45ezio.melottisetnosy: + loewis, ezio.melotti
messages: + msg1789
2010-08-13 18:44:37brett.cannonsetstatus: unread -> chatting
nosy: + brett.cannon
messages: + msg1788
2010-08-13 12:19:43r.david.murraycreate