Open patillacode opened 5 years ago
Hi again,
sorry for the various edits of this comment.
I believe that what could be missing in order to ever get a respond
method to be used in admin.py could be:
if review.submitter == request.user:
dummy_request.wagtailreview_mode = 'comment'
elif reviewer.user == request.user:
dummy_request.wagtailreview_mode = 'respond'
else:
dummy_request.wagtailreview_mode = 'view'
Thanks to Maylon for the final idea.
Also, after some thought, I think it could be useful to have the default modes for submitters, reviewers and users to be defined in the settings file, maybe something like:
WAGTAIL_REVIEW_DEFAULT_SUBMITTER_MODE
, WAGTAIL_REVIEW_DEFAULT_REVIEWER_MODE
& WAGTAIL_REVIEW_DEFAULT_USER_MODE
Then in admin.py we could have the following:
if review.submitter == request.user:
dummy_request.wagtailreview_mode = getattr(settings, "WAGTAIL_REVIEW_DEFAULT_SUBMITTER_MODE", "comment")
elif reviewer.user == request.user:
dummy_request.wagtailreview_mode = getattr(settings, "WAGTAIL_REVIEW_DEFAULT_REVIEWER_MODE", "respond")
else:
dummy_request.wagtailreview_mode = getattr(settings, "WAGTAIL_REVIEW_DEFAULT_USER_MODE", "view")
This would allow the developer to decide based on the specific use case what to do while having the fallback to the default behaviour if the variables are not defined.
For instance, someone could always allow comments to any user in their wagtail installation leaving them with the following in their settings
file:
WAGTAIL_REVIEW_DEFAULT_USER_MODE="comment"
I will create a PR shortly, hopefully you'll like the idea.
Hi!
So, I have been trying to add this, everything seems to work out of the box except for one thing.
This is what I would like to see in my review page:
And this in my
Audit Trail
:In my case, I can never see the nice
respond
window, nor the comment or status in theAudit Trail
(see images above) unless I hard code it like this:'allow_responses': True,
in wagtailreview_tags.pyI have noticed there are three values for
wagtailreview_mode
:view
,comment
andrespond
I believe the
respond
mode is missing in theview_review_page
view in admin.py or maybe I am not fully understanding or I am just missing something?I am the designated reviewer (in case you could think I jsut don't have permissions)
It is impossible for me, with the code as is, to ever entrer a review in
respond
mode, so my questions would be:Thanks for this piece of code and I hope you can respond soon!
Cheers!