decidim-ice / decidim-module-decidim_awesome

Additional components and Opt-In usability and UX tweaks for Decidim.
GNU Affero General Public License v3.0
25 stars 25 forks source link

URL rewriter is not respecting case sensitive links #239

Closed RCheesley closed 1 year ago

RCheesley commented 1 year ago

Describe the bug I need to rewrite a search string to something a bit easier to manage so that users can easily find all available groups.

I used the URL rewriter to do this, however it seems that the search system is case sensitive, and when the URL is saved it is becoming all lowercase, so the filter is no longer applied.

Origin: /groups

Destination: /search?filter%5Bterm%5D=&filter%5Bwith_resource_type%5D=Decidim%3A%3AUserGroup&filter%5Bwith_scope%5D=

When saved it becomes:

/search?filter%5bterm%5d=&filter%5bwith_resource_type%5d=decidim%3a%3ausergroup&filter%5bwith_scope%5d=

So while you do actually land on the search page, the group's filter is not selected which is confusing.

Screen recording: https://watch.screencastify.com/v/PoyLAYMan3PWM7kgV18i (sorry for the sniffles, just getting over covid!)

To Reproduce Steps to reproduce the behavior:

  1. Go a redirect manager and create a redirect
  2. Use the origin as /groups
  3. Use the destination as /search?filter%5Bterm%5D=&filter%5Bwith_resource_type%5D=Decidim%3A%3AUserGroup&filter%5Bwith_scope%5D=
  4. Save the redirect and navigate in the frontend to /groups
  5. Notice that you land on the search page but no search filters are applied

Expected behavior I would expect that either it would respect the case sensitivity (so that when you save the redirect it honours the case that was saved and doesn't convert it all to lowercase) or the case sensitivity would not matter at all, and the feature should work as expected - which might be a bug upstream.

Screenshots https://watch.screencastify.com/v/PoyLAYMan3PWM7kgV18i

Desktop (please complete the following information):

paulinebessoles commented 1 year ago

Hi @RCheesley ! I already reported this issue here, and closing it as yours is way better explained 😁

RCheesley commented 1 year ago

Ooof sorry, my bad! Should have searched first! 🤦‍♀️

froger commented 1 year ago

Saw this issue earlier, trying to add a redirection to the export calendar link. I noticed the form transform the destination url in downcase here:

https://github.com/decidim-ice/decidim-module-decidim_awesome/blob/main/app/forms/decidim/decidim_awesome/admin/custom_redirect_form.rb#L28

Would need to write tests, and unfortunately can't help on this these next few weeks… Hope it might help in the debugging process, thanks!

microstudi commented 1 year ago

Maybe we can fix this, it shouldn't be difficult. Although my preferred solution would be to add an checkbox for "case sensitive".

Note that to use this is generally not a good idea for creating friend redirections to attachments, this is because you can configure rails to expire those links and, therefore, will be always changing. To solve the media sharing we should create a "media pool" where to share those links. We could do that in a separate pr.

froger commented 1 year ago

Thanks for pointing out media issues @microstudi, I understand this is another feature (and it is not really needed our side)

About case-sensitivity, I wonder why it should have a checkbox: rails routing is case sensitive, so it makes sense to have case-sensitive links insertion by default. I guess users copy/paste urls for destination, so I don't see why we should have one more option in the admin side. But maybe I miss a special use-case?

microstudi commented 1 year ago

good point @froger , I think we can make it case-sensitive and that's it.

microstudi commented 1 year ago

This is fixed by #240