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

Bug: Submission model's publisher is not set on entry approval. #21

Closed
kotyy opened this issue Jan 5, 2017 · 2 comments
Closed

Bug: Submission model's publisher is not set on entry approval. #21

kotyy opened this issue Jan 5, 2017 · 2 comments
Labels

Comments

@kotyy
Copy link

kotyy commented Jan 5, 2017

Steps to reproduce:

  1. As an editor, modify an entry, save the draft and submit it for approval.
  2. As a publisher, in the workflow settings pane, check the submitted entry and set its status to approved.
  3. As an editor OR a publisher, try to visit the draft entry.
  4. Error.

It's worth noting that this doesn't happen on a rejection, only on an approval. The publishedId field in the DB is null. And, I have reproduced it with the latest version of Workflow, on two separate Craft installations.

I looked into the code, but it seems like it should be set just fine. Any advice?


Impossible to access an attribute ("cpEditUrl") on a null variable

/Users/koty/Sites/123/web/craft/plugins/workflow/templates/_includes/publisher-pane.html(17)

05 {% set pendingSubmissions = craft.workflow.submissions({ status: 'pending' }).count() %}
06 {% set nonPendingSubmissions = craft.workflow.submissions({ status: 'not pending' }).count() %}
07 
08 {% if nonPendingSubmissions %}
09     <div class="pane workflow-pane">
10         {% for submission in submissions if submission.status != 'pending' %}
11             {% if submission.status == 'approved' %}
12                 <div class="field">
13                     <div class="heading">
14                         <label>{{ "Approved submission" | t }}</label>
15 
16                         <div class="instructions">
17                             <p><a href="{{ submission.publisher.cpEditUrl }}">{{ submission.publisher }}</a> {{ "approved this entry on {date}." | t({ date: submission.dateApproved | date('jS M Y g:ia') }) }}</p>
18 
19                             {% if submission.notes %}
20                                 <p class="code">"{{ submission.notes }}"</p>
21                             {% endif %}
22                         </div>
23                     </div>
24                 </div>
25             {% elseif submission.status == 'rejected' %}
26                 <div class="field">
27                     <div class="heading">
28                         <label>{{ "Rejected submission" | t }}</label>
29 
2017-01-05 17:12:35 Apache/2.4.23 (Unix) PHP/5.5.30 / Craft CMS 2.6.2954```
@kotyy
Copy link
Author

kotyy commented Jan 17, 2017

So, I dug into this a bit more today.

When using element actions to change the status, it raises an onSetStatus event, which I presume is yet to be implemented and would handle adding the publisherId, et al.

However, that event is currently unhandled. Because all other methods of changing a Submission's status use actions, they are unaffected.

As a workaround, we can remove the elementactions code, which results in being unable to use, them obviously, but prevents the issues from occurring. I have a fork that has done this: kotyy@526a3fc

@engram-design
Copy link
Member

This has been fixed in 1.0.0 for Craft 3.

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

No branches or pull requests

2 participants