Closed gasman closed 4 years ago
Now fixed in 9191ea4f1c5f281bad52313d46bbe39fc4639abb, but just to check - @kaedroho, can I confirm that the code in initPageEditor
(admin/src/main.tsx) is still actively being used, but is only relevant during the edit view, not creation?
(also, can we please give GuacamoleMenuItem a less stupid name? :-) )
@kaedroho has confirmed that the JS in question is for handling review comments / history, which don't apply to the creation view, so I'm happy with this fix.
As for GuacamoleMenuItem, we hereby declare the term "guacamoleing" to be the act of using an unrelated hook to insert functionality that would otherwise not be possible, which means that it is now a meaningful name. :-)
As of the rewrite in https://github.com/wagtail/wagtail-review/pull/13, wagtail_hooks.py attempts to write
context['page'].id
to a Javascript variable:https://github.com/wagtail/wagtail-review/blob/5a835e0761d558433b0b4be7d7ae0be66dde3437/wagtail_review/wagtail_hooks.py#L120
context['page']
is only available on the edit view - on the page creation view, this fails with a KeyError. This can be fixed by wrapping this line inif context['view'] == 'edit':
, but clearly, any code that assumes the presence of a meaningful page ID is doomed to fail.It may be that the whole wagtail-review-admin.js module is redundant in the workflow rewrite, now that the UI for selecting reviewers exists elsewhere - if so, this code needs to be removed.