[openstreetmap/openstreetmap-website] Allow admins and moderators to delete traces (#1765)

Andy Allan notifications at github.com
Mon Feb 26 03:25:48 UTC 2018


Thanks! It looks good. I would ask you to make two more changes:

1) In the test, you have

> post :delete, :params => { :display_name => **admin**.display_name, :id => public_trace_file.id }, :session => { :user => admin }

The `display_name` parameter (i.e. the name used in the URL) should be for the user of the trace, not the admin doing the deleting. I know that the `display_name` is currently ignored by the code, but it's best to change it to: 

> post :delete, :params => { :display_name => **public_trace_file.user**.display_name, :id => public_trace_file.id }, :session => { :user => admin }

2) When an admin or moderator deletes a trace, I think it is best for them to be redirected to the list of traces for the user that owned that trace, rather than redirecting the admin to their own list of traces. This can be achieved by changing (in app/controllers/trace_controller.rb)

>  redirect_to :action => :list, :display_name => **current_user**.display_name

to 

> redirect_to :action => :list, :display_name => **trace.user**.display_name

and adjusting the test accordingly.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1765#issuecomment-368379799
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20180225/03cd2059/attachment-0001.html>


More information about the rails-dev mailing list