workflow icon indicating copy to clipboard operation
workflow copied to clipboard

Workflow email link does not link to the correct draft but only to the live version of the entry

Open azad6026 opened this issue 1 year ago • 15 comments

Describe the bug

Workflow email link does not link to the correct draft but only to the live version of the entry.

Steps to reproduce

  1. Editor edits a page and submits thier draft for approval as usual
  2. Publisher receives an email with the link to approve the entry submitted
  3. The email link is linking to the live version of that entry and not the correct draft , therefore , no button to approve anything and the publisher has to manually go to workflow and approve the entry. The link in the email does not have any draftId in it.

Craft CMS version

4.7.0

Plugin version

2.0.8

Multi-site?

No

Additional context

This happens both in local and production.

azad6026 avatar Feb 15 '24 00:02 azad6026

Quick clarification here - is the editor creating a brand new entry, or a draft on an already existing entry? The two processes can work slightly differently, so it's worth noting the difference one way or the other.

The submission.ownerCpUrl that's used in emails should resolve to the last review's owner cpEditUrl. In this case, the owner should be the draft entry you've submitted.

engram-design avatar Feb 17 '24 04:02 engram-design

Hello and thanks for coming back to this.If the editor is creating a brand new entry, the email link is correct. But if the editor is creating a draft on an existing entry,this process does not create the correct email link. This is the issue we hope to get a fix for as it is a problem for our clients. Thanks.

azad6026 avatar Feb 18 '24 04:02 azad6026

Hi there. Is there any response or thoughts available on this matter. This is important for us. Appreciate it. Cheers

azad6026 avatar Feb 22 '24 09:02 azad6026

Hi there,this issue is important for our clients and I would appreciate if it is being looked into and responded. Thanks

azad6026 avatar Feb 27 '24 21:02 azad6026

Haven't forgotten about this, just struggling to reproduce this one on our end. Are you able to send through the email template for the submission notification? These can be found in Utilities > System Messages.

engram-design avatar Feb 28 '24 14:02 engram-design

Actually, just after sending this I was able to replicate this one. Should be fixed for the next release. To get this early, run composer require verbb/workflow:"dev-craft-4 as 2.0.8".

engram-design avatar Feb 28 '24 14:02 engram-design

Thank you so very much. Tested it and the issue is now resolved. Cheers.

azad6026 avatar Mar 03 '24 02:03 azad6026

Updated in 2.0.9

engram-design avatar Mar 03 '24 13:03 engram-design

Hi, we are seeing this issue happen again for us, after updating to Craft 5.6.5.1 and Workflow 3.0.6.

In the email notification from the editor to the publisher, the {{ submission.ownerCpUrl }} variable is set to the current live version of the entry rather than the actual draft, the "?draftId=xxxxxx" is omitted.

43north avatar Feb 06 '25 02:02 43north

I'm not able to replicate this sorry. Can you locate the review in the workflow_reviews database table, and ensure that the draftId value is actually set?

engram-design avatar Feb 07 '25 04:02 engram-design

In this particular case, the draftId was not set in the table. But after further testing it seems to be fine for yet-to-be published entries. It seems to occur when the editor submits an additional draft to an already published listing that they want to update. The draftId for the new draft was set in the table but not displayed in the email notification, very strange.

43north avatar Feb 08 '25 06:02 43north

That was my next question, whether this was a brand-new entry, or a new draft on an entry. Technically in either case they should both be drafts, but just wanted to confirm regardless.

So just to confirm, you're making a submission on an already published entry (so a new draft is being made), and the draftId value is there - it's just in the email notification it's not linking to that draft?

engram-design avatar Feb 08 '25 08:02 engram-design

Yes, that's it exactly

43north avatar Feb 08 '25 08:02 43north

I think I've narrowed things down. Should be fixed for the next release. To get this early, run composer require verbb/workflow:"dev-craft-5 as 3.0.6".

engram-design avatar Feb 09 '25 00:02 engram-design

That seems to have done the trick, thanks!

43north avatar Feb 10 '25 04:02 43north

Updated in 3.0.8.

engram-design avatar May 01 '25 04:05 engram-design