Bug 23276

Summary: Don't show tags on tag cloud when tagging is disabled
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: aleisha, david, jonathan.druart, lucas, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.01, 19.11.07, 19.05.13
Attachments: Bug 23276: Do not display tag if pref TagsEnabled is off
Bug 23276: Do not display tag if pref TagsEnabled is off
Bug 23276: Do not display tag if pref TagsEnabled is off
Bug 23276: Do not display tag if pref TagsEnabled is off
Bug 23276: Do not display tag if pref TagsEnabled is off
Bug 23276: Do not display tag if pref TagsEnabled is off
Bug 23276: Do not display tag if pref TagsEnabled is off
Bug 23276: Do not display tag if pref TagsEnabled is off

Description Katrin Fischer 2019-07-08 08:46:07 UTC
When tagging is disabled, Koha still lets you acces the tags cloud page. It displays a message that tagging is disabled, but at the same time tags in the system are displayed:

.../cgi-bin/koha/opac-tags.pl

I think we should handle this like other pages and not have this page accessible when the feature is diabled. But at least we shoudl not show tags, that might have been added for testing the feature.
Comment 1 Jonathan Druart 2019-11-20 14:44:06 UTC Comment hidden (obsolete)
Comment 2 David Nind 2019-11-20 23:45:07 UTC
When I apply the patch, but leave TagsEnabled enabled I get this message when accessing the page:

  response = {
	  added: 0,
	  deleted: 0,
	  errors: 0
  };

When I disable TagsEnabled I get a long page of error messages starting with:

Can't call method "param" on an undefined value at /kohadevbox/koha/C4/Output.pm line 363
in C4::Output::output_and_exit at /kohadevbox/koha/C4/Output.pm line 363
  360: 
  361: sub output_and_exit {
  362:     my ( $query, $cookie, $template, $error ) = @_;
  363:     $template->param( blocking_error => $error );
  364:     output_html_with_http_headers ( $query, $cookie, $template->output );
  365:     exit;
  366: }

Hide function arguments

$_[0]	'CGI=HASH(0x559b4b806d98)'
$_[1]	undef
$_[2]	undef
$_[3]	'tags_disabled'

in (eval) at /kohadevbox/koha/opac/opac-tags.pl line 121
  118: }
  119: 
  120: 
  121: output_and_exit( $query, $cookie, $template, 'tags_disabled' )
  122:     unless C4::Context->preference('TagsEnabled');
  123: 
  124: if ($add_op) {
Comment 3 Jonathan Druart 2019-11-21 10:43:26 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2019-11-21 10:44:49 UTC
Sorry David, I added to the patch a last minute change that should never have been part of it.
Comment 5 David Nind 2019-11-21 11:10:16 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2019-11-22 21:50:00 UTC
Created attachment 95750 [details] [review]
Bug 23276: Do not display tag if pref TagsEnabled is off

If the pref TagsEnabled is off we should not display the tags at the
OPAC.
There is a message to tell that tags system is disabled, but the tags
are displayed.

This patch introduces the blocking_errors include file at the OPAC.

Test plan:
- Turn TagsEnabled on
- Add some tags
- Turn TagsEnabled off
- Hit /cgi-bin/koha/opac-tags.pl
=> Without this patch you see a warning messaging saying that the tag
system is disabled, but the tags are displayed
=> With this patch you see a (ugly) short screen saying that the tag
system is disabled.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2019-11-22 21:50:15 UTC
It's really a little ugly...
Comment 8 Jonathan Druart 2019-11-26 13:15:48 UTC
Created attachment 95825 [details] [review]
Bug 23276: Do not display tag if pref TagsEnabled is off

If the pref TagsEnabled is off we should not display the tags at the
OPAC.
There is a message to tell that tags system is disabled, but the tags
are displayed.

This patch introduces the blocking_errors include file at the OPAC.

Test plan:
- Turn TagsEnabled on
- Add some tags
- Turn TagsEnabled off
- Hit /cgi-bin/koha/opac-tags.pl
=> Without this patch you see a warning messaging saying that the tag
system is disabled, but the tags are displayed
=> With this patch you see a (ugly) short screen saying that the tag
system is disabled.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Jonathan Druart 2019-11-26 13:16:03 UTC
I removed a debug statement.
Comment 10 Owen Leonard 2019-11-26 13:42:41 UTC
I think it would be better to remove the in-page message altogether and trigger a 404 if tagging is disabled and the user navigates directly to opac-tags.pl. This is what we do with opac-topissues.pl and opac-suggestions.pl.
Comment 11 Jonathan Druart 2019-11-27 09:12:03 UTC
I am good with both approaches.

I wanted to provide a patch that kept the original behavior. As well it introduces the use of blocking-errors.inc OPAC-side, which was a good move forward.
Comment 12 Katrin Fischer 2020-05-25 22:12:34 UTC
I think I agree with Owen about the 404 - especially since it seems what we do in other cases. Moving this out of 'in discussion'. I am not sure if we should add an alternate patch or can/should keep the work on blocking errors somehow?
Comment 13 Jonathan Druart 2020-05-26 08:39:20 UTC
Created attachment 105349 [details] [review]
Bug 23276: Do not display tag if pref TagsEnabled is off

If the pref TagsEnabled is off we should not display the tags at the
OPAC.
There is a message to tell that tags system is disabled, but the tags
are displayed.

We should redirect to 404 like we do in opac-topissues.pl and
opac-suggestions.pl.

Test plan:
- Turn TagsEnabled on
- Add some tags
- Turn TagsEnabled off
- Hit /cgi-bin/koha/opac-tags.pl
=> Without this patch you see a warning messaging saying that the tag
system is disabled, but the tags are displayed
=> With this patch you get a 404 redirect
Comment 14 David Nind 2020-05-26 10:49:20 UTC
Created attachment 105354 [details] [review]
Bug 23276: Do not display tag if pref TagsEnabled is off

If the pref TagsEnabled is off we should not display the tags at the
OPAC.
There is a message to tell that tags system is disabled, but the tags
are displayed.

We should redirect to 404 like we do in opac-topissues.pl and
opac-suggestions.pl.

Test plan:
- Turn TagsEnabled on
- Add some tags
- Turn TagsEnabled off
- Hit /cgi-bin/koha/opac-tags.pl
=> Without this patch you see a warning messaging saying that the tag
system is disabled, but the tags are displayed
=> With this patch you get a 404 redirect

Signed-off-by: David Nind <david@davidnind.com>
Comment 15 Katrin Fischer 2020-05-28 22:58:41 UTC
Created attachment 105428 [details] [review]
Bug 23276: Do not display tag if pref TagsEnabled is off

If the pref TagsEnabled is off we should not display the tags at the
OPAC.
There is a message to tell that tags system is disabled, but the tags
are displayed.

We should redirect to 404 like we do in opac-topissues.pl and
opac-suggestions.pl.

Test plan:
- Turn TagsEnabled on
- Add some tags
- Turn TagsEnabled off
- Hit /cgi-bin/koha/opac-tags.pl
=> Without this patch you see a warning messaging saying that the tag
system is disabled, but the tags are displayed
=> With this patch you get a 404 redirect

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 16 Jonathan Druart 2020-06-15 09:59:16 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 17 Lucas Gass 2020-06-17 22:37:11 UTC
backported to 20.05.x for 20.05.01
Comment 18 Aleisha Amohia 2020-06-22 03:07:10 UTC
backported to 19.11.x for 19.11.07
Comment 19 Victor Grousset/tuxayo 2020-07-02 22:47:11 UTC
Backported to 19.05.x branch for 19.05.13