[Bug 30663] New: API (/api/v1/suggestions) won't honor MaxOpenSuggestions
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Bug ID: 30663 Summary: API (/api/v1/suggestions) won't honor MaxOpenSuggestions Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: lucas@bywatersolutions.com CC: tomascohen@gmail.com To recreate: -Set MaxOpenSuggestions to something low, like 1. -Make some suggestions via the API, making sure they are not anonymous and they include a status of 'ASKED'. -You can make as many requests as you want, regardless of MaxOpenSuggestions. I am using this simple jQuery snippet to test: $.ajax({ type: 'POST', url: '/api/v1/suggestions/', data: '{"collection_title": "dasdas", "suggested_by": 5}', success: function(data) { console.log('suggestion added'); }, contentType: "application/json", dataType: 'json' }); -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Status|ASSIGNED |Needs Signoff Summary|API (/api/v1/suggestions) |POST /api/v1/suggestions |won't honor |won't honor |MaxOpenSuggestions |MaxOpenSuggestions Severity|enhancement |normal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 134541 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134541&action=edit Bug 30663: Add Koha::Suggestions helper methods This patch adds the following helper methods: * filter_by_pending * filter_by_suggested_days_range This methods follow basically what's done in opac-suggestions.pl I chose 'pending' as opposed to 'open' to follow what we use in the UI which might be the case because of being more accurate for end users. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Suggestions.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 134542 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134542&action=edit Bug 30663: Add x-koha-override options to /suggestions This patch adds the x-koha-override header parameter to the route that is used to create suggestions, POST /suggestions. The idea is that adding suggestions will be rejected under certain conditions unless x-koha-override is passed with appropriate values. The added overrides are: * any * max_total * max_pending Tests are added for the expected behavior. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 134543 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134543&action=edit Bug 30663: Implement overrides handling in POST /suggestions This patch implements the override checks in the controller as expected by the previous patch. To test: 1. Apply this bug patches up to 'Add x-koha-override options...' 2. Run: $ kshell k$ prove t/db_dependent/api/v1/suggestions.t => FAIL: Tests fail! The controller doesn't care about overrides or sysprefs about suggestions limits. 3. Apply this patch 4. Repeat 2 => SUCCESS: Things work! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|POST /api/v1/suggestions |POST /api/v1/suggestions |won't honor |won't honor suggestions |MaxOpenSuggestions |limits See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=21889 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #134541|0 |1 is obsolete| | --- Comment #4 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 134544 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134544&action=edit Bug 30663: Add Koha::Suggestions helper methods This patch adds the following helper methods: * filter_by_pending * filter_by_suggested_days_range This methods follow basically what's done in opac-suggestions.pl I chose 'pending' as opposed to 'open' to follow what we use in the UI which might be the case because of being more accurate for end users. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Suggestions.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #134542|0 |1 is obsolete| | --- Comment #5 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 134545 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134545&action=edit Bug 30663: Add x-koha-override options to /suggestions This patch adds the x-koha-override header parameter to the route that is used to create suggestions, POST /suggestions. The idea is that adding suggestions will be rejected under certain conditions unless x-koha-override is passed with appropriate values. The added overrides are: * any * max_total * max_pending Tests are added for the expected behavior. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #134543|0 |1 is obsolete| | --- Comment #6 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 134546 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134546&action=edit Bug 30663: Implement overrides handling in POST /suggestions This patch implements the override checks in the controller as expected by the previous patch. To test: 1. Apply this bug patches up to 'Add x-koha-override options...' 2. Run: $ kshell k$ prove t/db_dependent/api/v1/suggestions.t => FAIL: Tests fail! The controller doesn't care about overrides or sysprefs about suggestions limits. 3. Apply this patch 4. Repeat 2 => SUCCESS: Things work! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=30674 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #134544|0 |1 is obsolete| | --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 134604 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134604&action=edit Bug 30663: Add Koha::Suggestions helper methods This patch adds the following helper methods: * filter_by_pending * filter_by_suggested_days_range This methods follow basically what's done in opac-suggestions.pl I chose 'pending' as opposed to 'open' to follow what we use in the UI which might be the case because of being more accurate for end users. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Suggestions.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #134545|0 |1 is obsolete| | --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 134605 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134605&action=edit Bug 30663: Add x-koha-override options to /suggestions This patch adds the x-koha-override header parameter to the route that is used to create suggestions, POST /suggestions. The idea is that adding suggestions will be rejected under certain conditions unless x-koha-override is passed with appropriate values. The added overrides are: * any * max_total * max_pending Tests are added for the expected behavior. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #134546|0 |1 is obsolete| | --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 134606 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134606&action=edit Bug 30663: Implement overrides handling in POST /suggestions This patch implements the override checks in the controller as expected by the previous patch. To test: 1. Apply this bug patches up to 'Add x-koha-override options...' 2. Run: $ kshell k$ prove t/db_dependent/api/v1/suggestions.t => FAIL: Tests fail! The controller doesn't care about overrides or sysprefs about suggestions limits. 3. Apply this patch 4. Repeat 2 => SUCCESS: Things work! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Great work.. as a follow-up bug I'd love to see us move these checks and override into the Object classes.. but given this is a bug and there's already work underway in those classes I think this is an acceptable middle ground. Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |major -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed for 22.05. Thanks everyone. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |22.05.00 released in| | CC| |fridolin.somers@biblibre.co | |m -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 --- Comment #12 from Lucas Gass <lucas@bywatersolutions.com> --- It would be very helpful if this could be backported to 21.11, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com --- Comment #13 from Kyle M Hall <kyle@bywatersolutions.com> --- Doesn't apply to 21.11.x, please rebase if needed! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 --- Comment #14 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 134987 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134987&action=edit [21.11.x] Bug 30663: Add x-koha-override options to /suggestions This patch adds the x-koha-override header parameter to the route that is used to create suggestions, POST /suggestions. The idea is that adding suggestions will be rejected under certain conditions unless x-koha-override is passed with appropriate values. The added overrides are: * any * max_total * max_pending Tests are added for the expected behavior. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 134988 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134988&action=edit [21.11.x] Bug 30663: Implement overrides handling in POST /suggestions This patch implements the override checks in the controller as expected by the previous patch. To test: 1. Apply this bug patches up to 'Add x-koha-override options...' 2. Run: $ kshell k$ prove t/db_dependent/api/v1/suggestions.t => FAIL: Tests fail! The controller doesn't care about overrides or sysprefs about suggestions limits. 3. Apply this patch 4. Repeat 2 => SUCCESS: Things work! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|22.05.00 |22.05.00,21.11.06 released in| | Status|Pushed to master |Pushed to stable --- Comment #16 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to 21.11.x for 21.11.06 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|22.05.00,21.11.06 |22.05.00,21.11.06,21.05.16 released in| | CC| |victor@tuxayo.net Status|Pushed to stable |Needs documenting --- Comment #17 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Backported: Pushed to 21.05.x branch for 21.05.16 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30663 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org