Bug 20207 - Anonymous suggestions show in OPAC even when OPACViewOthersSuggestions is set to 'Don't show'
Summary: Anonymous suggestions show in OPAC even when OPACViewOthersSuggestions is set...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Mark Hofstetter
QA Contact: Katrin Fischer
URL:
Keywords: regression, rel_22_11_candidate
Depends on:
Blocks:
 
Reported: 2018-02-15 12:48 UTC by Jessie Zairo
Modified: 2023-06-08 22:28 UTC (History)
2 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00


Attachments
Bug 20207: Anonymous Purchase Suggestions show on OPAC even when OPACViewOthersSuggestions is set to Don't Show (2.81 KB, patch)
2022-11-11 12:55 UTC, Mark Hofstetter
Details | Diff | Splinter Review
Bug 20207: Anonymous Purchase Suggestions show on OPAC even when OPACViewOthersSuggestions is set to Don't Show (2.86 KB, patch)
2022-11-11 20:33 UTC, David Nind
Details | Diff | Splinter Review
Screenshot [22.05.x] - logged in patron purchase suggestions (63.57 KB, image/png)
2022-11-11 23:35 UTC, David Nind
Details
Bug 20207: Don't show anyones's suggestions when OPACViewOthersSuggestions is deactivated (2.90 KB, patch)
2022-11-13 14:10 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 20207: Don't show search options when no suggestions show (2.54 KB, patch)
2022-11-13 14:10 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jessie Zairo 2018-02-15 12:48:10 UTC
When you enable AnonSuggestions and ALLOW patrons that aren't logged in to make purchase suggestions, once a suggestion has successfully been submitted,   Anonymous Purchase Suggestions will show on OPAC even when system preference OPACViewOthersSuggestions, is set to Don't Show. 

The suggestions will show on opac-suggestions.pl. However, if you search for the title you suggested, you will get a message saying "You are not authorized to see pending purchase suggestions."
Comment 1 Mark Hofstetter 2022-11-11 00:51:25 UTC
quick testing on 22.05.05.000 seem to indicate that this bug still persists

although it seems to work on 21.05.04.000
Comment 2 Mark Hofstetter 2022-11-11 12:55:14 UTC
Created attachment 143789 [details] [review]
Bug 20207: Anonymous Purchase Suggestions show on OPAC even when OPACViewOthersSuggestions is set to Don't Show

When you enable AnonSuggestions and ALLOW patrons that aren't logged in to make purchase suggestions, once a suggestion has successfully been submitted,   Anonymous Purchase Suggestions will show on OPAC even when system preference OPACViewOthersSuggestions, is set to Don't Show.

The suggestions will show on opac-suggestions.pl. However, if you search for the title you suggested, you will get a message saying "You are not authorized to see pending purchase suggestions."

This patch fixes the error, ie if OPACViewOthersSuggestions is set to false not other suggestions are shown (if you are not logged in and AnonSuggestions) OR ONLY your own suggestions if you are logged in

To test:
1) activate AnonSuggestions
2) create an anon suggestion
3) create a suggestion with a logged in user
4) toggle OPACViewOthersSuggestions Show/Don't show
5) all suggestions are shown cgi-bin/koha/opac-suggestions.pl in either case
6) apply patch
7) OPACViewOthersSuggestions is now respected ie suggestions from other users are only shown if activated
8) Please sign off

Sponsored-by: Library of the Natural History Museum Vienna
Comment 3 David Nind 2022-11-11 20:33:42 UTC
Created attachment 143798 [details] [review]
Bug 20207: Anonymous Purchase Suggestions show on OPAC even when OPACViewOthersSuggestions is set to Don't Show

When you enable AnonSuggestions and ALLOW patrons that aren't logged in to make purchase suggestions, once a suggestion has successfully been submitted,   Anonymous Purchase Suggestions will show on OPAC even when system preference OPACViewOthersSuggestions, is set to Don't Show.

The suggestions will show on opac-suggestions.pl. However, if you search for the title you suggested, you will get a message saying "You are not authorized to see pending purchase suggestions."

This patch fixes the error, ie if OPACViewOthersSuggestions is set to false not other suggestions are shown (if you are not logged in and AnonSuggestions) OR ONLY your own suggestions if you are logged in

To test:
1) activate AnonSuggestions
2) create an anon suggestion
3) create a suggestion with a logged in user
4) toggle OPACViewOthersSuggestions Show/Don't show
5) all suggestions are shown cgi-bin/koha/opac-suggestions.pl in either case
6) apply patch
7) OPACViewOthersSuggestions is now respected ie suggestions from other users are only shown if activated
8) Please sign off

Sponsored-by: Library of the Natural History Museum Vienna

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2022-11-11 20:40:57 UTC
This fixes the display of purchase suggestions on the OPAC when not logged in 

However, if you are a logged in user on the OPAC you still only see your own purchase suggestions. (Home > Your account > Purchase suggestions > [toggle 'Suggested by anyone' and 'Suggested by me' in search for]

Should this be fixed on this bug, or a new one?
Comment 5 Mark Hofstetter 2022-11-11 20:54:25 UTC
sorry I don't see the possibility to [toggle 'Suggested by anyone' and 'Suggested by me' in search for] I am working on 22.05

imho OPACViewOthersSuggestions suggests (sorry f the pun) that no other suggestions are shown. Maybe 'Suggested by anyone' should be rephrased or only shown if OPACViewOthersSuggestions is true
Comment 6 David Nind 2022-11-11 23:35:10 UTC
Created attachment 143800 [details]
Screenshot [22.05.x] - logged in patron purchase suggestions

Apologies for any confusion caused!

I've run through things again (detailed notes below), with these conclusions:

- This patch fixes things on master for the issue identified in this bug (I didn't try and apply the patch to 22.05.x)

- A separate bug is required for master only for logged in patrons: if OPACViewOthersSuggestions is set to 'Show', it only shows the logged in patron's suggestions and not all suggestions (this is working correctly on 22.05.x, but NOT on master)

I hope I haven't confused things even more!

22.05.x
=======

Setup: need at least x1 suggestion already by an anonymous patron, and x1 suggestion by a logged in patron.

Not logged in
-------------

AnonSuggestions set to 'Allow'
AND
OPACViewOthersSuggestions set to 'Show'
AND
when not logged in

From OPAC home > Purchase suggestions:
==> displays suggestions from anonymous and logged in patrons (as expected)

If OPACViewOthersSuggestions is set to "Don't show":
==> doesn't display any suggestions (as expected)

If OPACViewOthersSuggestions is set to "Don't show" and you add a new suggestion when not logged in:
==> it shows other suggestions made by anonymous users (but NOT suggestions made by logged in users)

Logged in
---------

Login as a patron and go to Your account > Purchase suggestions - purchase suggestions show correctly:
- OPACViewOthersSuggestions set to "Don't show" - can only see your own suggestions (as expected)
- OPACViewOthersSuggestions set to "Show" - after the search for the input field there is a dropdown list with options to show suggestions "Suggested by me" and "Suggested by anyone", works as expected

master
======

Setup: need at least x1 suggestion already by an anonymous patron, and x1 suggestion by a logged in patron.

Not logged in
-------------

AnonSuggestions set to 'Allow'
AND
OPACViewOthersSuggestions set to 'Show'
AND
when not logged in

From OPAC home > Purchase suggestions:
==> displays suggestions from anonymous and logged in patrons (as expected)

If OPACViewOthersSuggestions is set to "Don't show":
==> displays suggestions from anonymous and logged in patrons (NOT expected, also different behaviour from 22.05.x where it does not show any suggestions)

If OPACViewOthersSuggestions is set to "Don't show" and you add a new suggestion when not logged in:
==> it shows other suggestions made by anonymous AND logged in patrons (NOT expected, also different behaviour from 22.05.x where it only shows suggestions from anonymous users).

Logged in user
--------------

Login as a patron and go to Your account > Purchase suggestions - purchase suggestions DON'T show correctly:
- OPACViewOthersSuggestions set to "Don't show" - can only see your own suggestions (as expected)
- OPACViewOthersSuggestions set to "Show" - after the search for the input field there is a dropdown list with options to show suggestions "Suggested by me" and "Suggested by anyone", correctly shows your own suggestions, but when you select "Suggested by anyone" and press 'Go' it DOESN'T show suggestions made by others (NOT expected, different behaviour from 22.05.x where it works as expected)
Comment 7 Katrin Fischer 2022-11-13 13:38:30 UTC
2 things here (for the future):
 
* When fixing a bug, make sure it's marked as such (bugzilla defaults to enhancement). This can influence how fast things are looked at, if they are pushed to stable vesions etc.
* The bug title should describe the problem, the commit message/subject shoudl describe the fix.
Comment 8 Katrin Fischer 2022-11-13 14:10:54 UTC
Created attachment 143811 [details] [review]
Bug 20207: Don't show anyones's suggestions when OPACViewOthersSuggestions is deactivated

When you enable AnonSuggestions and ALLOW patrons that aren't logged
in to make purchase suggestions, once a suggestion has successfully
been submitted, anonymous purchase suggestions will show on OPAC even
when system preference OPACViewOthersSuggestions, is set to Don't show.

The suggestions will show on opac-suggestions.pl. However, if you search
for the title you suggested, you will get a message saying
"You are not authorized to see pending purchase suggestions."

This patch fixes the error, ie if OPACViewOthersSuggestions is set to
false not other suggestions are shown (if you are not logged in and AnonSuggestions)
OR ONLY your own suggestions if you are logged in

To test:
1) activate AnonSuggestions
2) create an anon suggestion
3) create a suggestion with a logged in user
4) toggle OPACViewOthersSuggestions Show/Don't show
5) all suggestions are shown cgi-bin/koha/opac-suggestions.pl in either case
6) apply patch
7) OPACViewOthersSuggestions is now respected ie suggestions from other users are only shown if activated
8) Please sign off

Sponsored-by: Library of the Natural History Museum Vienna

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Katrin Fischer 2022-11-13 14:10:59 UTC
Created attachment 143812 [details] [review]
Bug 20207: Don't show search options when no suggestions show

When you are not logged in and OPACViewOthersSuggestions is
deactivated, you don't see any suggestions.

When we see no suggestions, we should also not show the option
to serach in suggestions.

To test:
* as a logged in user and logged out, try various combinations of:
  * OPACViewOthersSuggestions
  * AnonSuggestions
* Verify display matches expectations (new button, shown suggestions,
  search input)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Katrin Fischer 2022-11-13 14:11:43 UTC
No string changes.
Comment 11 Tomás Cohen Arazi 2022-11-14 12:22:08 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!