Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the "respond" review mode #2

Open
patillacode opened this issue Jan 7, 2019 · 1 comment
Open

About the "respond" review mode #2

patillacode opened this issue Jan 7, 2019 · 1 comment

Comments

@patillacode
Copy link
Contributor

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:

screenshot 2019-01-07 at 18 59 53

screenshot 2019-01-07 at 18 50 13

And this in my Audit Trail:

screenshot 2019-01-07 at 18 51 59

In my case, I can never see the nice respond window, nor the comment or status in the Audit Trail (see images above) unless I hard code it like this:
'allow_responses': True, in wagtailreview_tags.py

I have noticed there are three values forwagtailreview_mode: view, comment and respond

I believe the respond mode is missing in the view_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:

  • Am I missing something? Misconfigured something?
  • Is this the intended behaviour? is it actually a bug?

Thanks for this piece of code and I hope you can respond soon!

Cheers!

@patillacode
Copy link
Contributor Author

patillacode commented Jan 8, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant