Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug when filtering anonymous feedback #1175

Merged
merged 1 commit into from
Sep 5, 2023
Merged

Fix bug when filtering anonymous feedback #1175

merged 1 commit into from
Sep 5, 2023

Conversation

MuriloDalRi
Copy link
Contributor

The current code won't show the feedback for an organisation unless a '/' URL is specified.

https://trello.com/c/b8wn2ZQK/3252-improve-anonymousfeedback-search-behaviour-in-support-app-2

Copy link
Contributor

@ChrisBAshton ChrisBAshton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MuriloDalRi - this fix looks nice and simple, but it's missing two things:

  1. A test.
  2. Removal of whatever code is causing the current behaviour of a random URL being added to the 'URL' field (like this: "/e38e5fb202880093ee51").

The current code won't show the feedback for an organisation unless
a '/' URL is specified.

https://trello.com/c/b8wn2ZQK/3252-improve-anonymousfeedback-search-behaviour-in-support-app-2
@MuriloDalRi
Copy link
Contributor Author

MuriloDalRi commented Sep 4, 2023

Thanks @MuriloDalRi - this fix looks nice and simple, but it's missing two things:

  1. A test.
  2. Removal of whatever code is causing the current behaviour of a random URL being added to the 'URL' field (like this: "/e38e5fb202880093ee51").

@ChrisBAshton I've added a test now.
Do you mean a random URL being added to the form or to the browser's address bar? If you filter with an empty URL field it will now just add a / to the URL field.

@ChrisBAshton
Copy link
Contributor

Thanks, the test looks good. Yep, we should remove the associated code as it now will no longer ever get evaluated. Aga reckons it's the SecureRandom.hex(10) here that needs removing:

https://github.com/alphagov/support/blob/main/app/models/support/requests/anonymous/paths.rb#L7

@MuriloDalRi
Copy link
Contributor Author

it now will no longer ever get evaluated

I don't think that's true, don't see any reason for removing it.

Copy link
Contributor

@ChrisBAshton ChrisBAshton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just tried it out locally - and yes, looks like it will be difficult to unpick the SecureRandom. I believe it's used in the saved paths feature. By removing the hex, we're no longer storing at a unique key in Redis, and locally I was finding the search of / was "sticking" and making it impossible to try to submit an empty form, which would kind of solve this issue but could also be hiding a more gnarly bug under the surface.

Your fix seems to work in a nice low-risk way, so happy to approve 👍

@MuriloDalRi
Copy link
Contributor Author

I've just tried it out locally - and yes, looks like it will be difficult to unpick the SecureRandom. I believe it's used in the saved paths feature. By removing the hex, we're no longer storing at a unique key in Redis, and locally I was finding the search of / was "sticking" and making it impossible to try to submit an empty form, which would kind of solve this issue but could also be hiding a more gnarly bug under the surface.

Your fix seems to work in a nice low-risk way, so happy to approve 👍

Thanks @ChrisBAshton

@MuriloDalRi MuriloDalRi merged commit cdc7c98 into main Sep 5, 2023
8 checks passed
@MuriloDalRi MuriloDalRi deleted the fix-bug branch September 5, 2023 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants