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

UIU-2995 - Update resourceData and queryParams in UserSearchContainer.js to escape special characters in tags filter #2584

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

Terala-Priyanka
Copy link
Contributor

@Terala-Priyanka Terala-Priyanka commented Nov 9, 2023

Purpose

UIU-2995 - Mask/escape backslash and double quote in tag search

Approach

Special characters like ",*,?,\ are allowed in creation of tags.
When such a tag is searched in users app via the "Tags" filter, an error like "QueryValidationException: ? wildcard not allowed in full text query string" and "QueryValidationException: * right truncation wildcard must be followed by space or end of string, but found .." are observed.

Hence, the tags filters are escaped before passing them to makeQueryFunction.

TODOS and Open Questions

Learning

Screencast

chrome_KnP3FezMPz

Pre-Merge Checklist

Before merging this PR, please go through the following list and take appropriate actions.

  • I've added appropriate record to the CHANGELOG.md
  • Does this PR meet or exceed the expected quality standards?
    • Code coverage on new code is 80% or greater
    • Duplications on new code is 3% or less
    • There are no major code smells or security issues
  • Does this introduce breaking changes?
    • If any API-related changes - okapi interfaces and permissions are reviewed/changed correspondingly
    • There are no breaking changes in this PR.

If there are breaking changes, please STOP and consider the following:

  • What other modules will these changes impact?
  • Do JIRAs exist to update the impacted modules?
    • If not, please create them
    • Do they contain the appropriate level of detail? Which endpoints/schemas changed, etc.
    • Do they have all they appropriate links to blocked/related issues?
  • Are the JIRAs under active development?
    • If not, contact the project's PO and make sure they're aware of the urgency.
  • Do PRs exist for these changes?
    • If so, have they been approved?

Ideally all of the PRs involved in breaking changes would be merged in the same day to avoid breaking the folio-testing environment. Communication is paramount if that is to be achieved, especially as the number of intermodule and inter-team dependencies increase.

While it's helpful for reviewers to help identify potential problems, ensuring that it's safe to merge is ultimately the responsibility of the PR assignee.

@Terala-Priyanka Terala-Priyanka requested review from zburke, JohnC-80 and a team November 9, 2023 06:16
Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

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

I don't love this:

if (f.startsWith('tags.')) {

It works as long as nobody adds other fields with that prefix. Maybe/probably that's unlikely to happen, but it's pretty hacky. Could you at least add a function header comment for escapeSpecialCharactersInTagFilters that explains what's going on, and why?

Copy link

sonarqubecloud bot commented Nov 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

88.9% 88.9% Coverage
0.0% 0.0% Duplication

@Terala-Priyanka
Copy link
Contributor Author

I don't love this:

if (f.startsWith('tags.')) {

It works as long as nobody adds other fields with that prefix. Maybe/probably that's unlikely to happen, but it's pretty hacky. Could you at least add a function header comment for escapeSpecialCharactersInTagFilters that explains what's going on, and why?

Updated!

@Terala-Priyanka Terala-Priyanka merged commit 27c788e into master Nov 9, 2023
4 checks passed
@Terala-Priyanka Terala-Priyanka deleted the UIU-2995 branch November 9, 2023 16:45
Terala-Priyanka added a commit that referenced this pull request Nov 10, 2023
….js to escape special characters in tags filter (#2584)

* UIU-2995 - Update resourceData and queryParams in UserSearchContainer.js to escape special characters in tags filter

* UIU-2995 - Upade changelog description

* UIU-2955 - add a header comment to escapeSpecialCharactersInTagFilters function
Terala-Priyanka added a commit that referenced this pull request Nov 10, 2023
* UIU-2977 x-okapi-token header must always be optional (#2578)

The `X-Okapi-Token` header is optional and should only be included when
a token value is present on the `stripes.okapi` object.

Refs UIU-2977

* UIU-2959 Accordion collapse/expand all shortcuts not working on Edit form. (#2566)

* use handlers frome stripes-components

* update yarn.lock

* log changes

* update yarn lock

* UIU-2973 - Update patron groups retrieval in user search to hold maxUnpagedResourceCount (#2583)

* UIU-2995 - Update resourceData and queryParams in UserSearchContainer.js to escape special characters in tags filter (#2584)

* UIU-2995 - Update resourceData and queryParams in UserSearchContainer.js to escape special characters in tags filter

* UIU-2995 - Upade changelog description

* UIU-2955 - add a header comment to escapeSpecialCharactersInTagFilters function

* Add the possibility to do "Claim returned" from action menu (#2585)

* Release v10.0.4

---------

Co-authored-by: Zak Burke <[email protected]>
Co-authored-by: John Coburn <[email protected]>
Co-authored-by: Artem Blazhko <[email protected]>
Terala-Priyanka added a commit that referenced this pull request Dec 5, 2023
…irtual item. (#2601)

* UIU-2967 Don't display affiliations of users with types `patron` or `dcb` (#2570)

* UIU-2967 Don't display affiliations of users with types 'patron' or 'dbc'

* PT comment

* add tests

* import order

* fix type naming

* UIU-2970 Make the `username` field required for users with the `staff` type in "ECS" mode (#2571)

* UIU-2970 Make the 'username' field required for users with the 'staff' type in ECS mode

* add unit tests

* Release v10.0.1 (#2574)

* Release v10.0.2 (#2577)

* Release v10.0.3

* Release v10.0.4 (#2586)

* UIU-2977 x-okapi-token header must always be optional (#2578)

The `X-Okapi-Token` header is optional and should only be included when
a token value is present on the `stripes.okapi` object.

Refs UIU-2977

* UIU-2959 Accordion collapse/expand all shortcuts not working on Edit form. (#2566)

* use handlers frome stripes-components

* update yarn.lock

* log changes

* update yarn lock

* UIU-2973 - Update patron groups retrieval in user search to hold maxUnpagedResourceCount (#2583)

* UIU-2995 - Update resourceData and queryParams in UserSearchContainer.js to escape special characters in tags filter (#2584)

* UIU-2995 - Update resourceData and queryParams in UserSearchContainer.js to escape special characters in tags filter

* UIU-2995 - Upade changelog description

* UIU-2955 - add a header comment to escapeSpecialCharactersInTagFilters function

* Add the possibility to do "Claim returned" from action menu (#2585)

* Release v10.0.4

---------

Co-authored-by: Zak Burke <[email protected]>
Co-authored-by: John Coburn <[email protected]>
Co-authored-by: Artem Blazhko <[email protected]>

* UIU-2964 - [DCB] Loan details: Disable loan actions (Lending library) (#2590)

* UIU-3000 Can not edit shadow user account (#2589)

* Release v10.0.5 (#2593)

* UIU-2987-poppy-dcb - Hide all actionalble buttons on user details pane (#2594)

* UIU-2987-poppy-dcb - Hide all actionalble buttons on user details pane

* UIU-2987-poppy-dcb - fix unit test failure

* UIU-2987-poppy-dcb - fix lint error

* UIU-2988-poppy-dcb - User - Open Loans: UI changes for supporting DCB circulation (#2598)

* UIU-2966-poppy-dcb - display item title and barcode as text for dcb virtual item.

---------

Co-authored-by: Yury Saukou <[email protected]>
Co-authored-by: Zak Burke <[email protected]>
Co-authored-by: John Coburn <[email protected]>
Co-authored-by: Artem Blazhko <[email protected]>
Co-authored-by: Mikita Siadykh <[email protected]>
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.

3 participants