https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44093

--- Comment #1 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 211743
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211743&action=edit
Bug 44093: Do not render every notice of Notices management on each load

Each notice listed in Notices management rendered a hidden frame with its
full content, and ran its own queries for its patron, the category of the
patron, and its notice template. With up to 1000 notices listed, that is
up to 1000 hidden frames and over a thousand extra queries on each load.

* The content of a notice is no longer in the list. It is loaded when the
  notice is opened, from a new 'content' action of tools/notices.pl. It
  gives the content as JSON, which the browser does not show as a page,
  as the content of a notice must not run in the page, and it is shown in
  the same frame that cannot run anything. The notices that cannot be seen
  by the user are not found, and the permission is the one of the page
* The patrons of the notices, and their category, are fetched with the
  notices, not one by one. The notice template was only needed for the
  content

For 300 notices, a load of the page went from 655 to 54 queries.

To test:
1. Set 'NoticesManagement' to 'Enable' and queue some notices, for
   example by sending welcome notices to patrons that have an email
   address and running perl misc/cronjobs/process_message_queue.pl
2. Go to More > Tools > Notices management
3. Confirm the notices are listed and, in the page source, there is no
   hidden frame and no content for each of them
4. Click the subject of a notice: it is shown in a frame, as before, and
   the Resend, Print and Convert to print buttons work as before
5. Click the subject of a PASSWORD_RESET notice: its content is not
   displayed
6. To see the queries, with 300 or more notices, compare the number of
   queries of a load with and without the patch (for example with the
   Questions of 'SHOW GLOBAL STATUS' of the database, before and after
   a load of the page)
7. Run: yarn cypress run --spec
t/cypress/integration/Tools/NoticesManagement_spec.ts

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to