craftcms / craftcms/cms

[4.x]: Drafted Versions Failing to Apply with New Sites Added

Open
#13,563 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug craft4
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

What happened?
Description

A client tried to apply some drafts that they had accidentally added a new site to, then disabled. The new (disabled) sites on the drafted version were preventing the draft from applying due to the site not existing on the published entry.

Steps to reproduce
  1. Create an entry on 1 site (Site A)
  2. Create a draft of that entry and add to second site (Site B) but disable on Site B
  3. Attempt to apply the draft
Expected behavior

Draft applies. I could see this adding the entry to Site B in a disabled state.

Actual behavior

Draft throws internal server error (UnsupportedSiteException)

My current solve for this was to add the sites to the published version in a disabled state and then apply the draft. There's also no way of "Deleting Draft for Site" similar to "Delete Entry for Site". I could see just an X in the "Status" Field of drafts to delete for that site as a solution.

Craft CMS version

Craft Pro 4.4.17

PHP version

8.1.17

Operating system and version

Linux 5.4.0-144-generic

Database type and version

MySQL 8.0.26

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.10-23)

Installed plugins and versions
Plugin Version
Colorit 4.0.0
Control Panel CSS 2.6.0
Control Panel JS 2.6.0
Dashboard Begone 2.0.0
DigitalOcean Spaces Filesystem 2.0.0
Documentation 4.0.0
Feed Me 5.2.0
Neo 3.8.6
Netlify Status v1.1.0
Publisher X 3.0.1
Redactor 3.0.4
Redactor Custom Styles 4.0.3
Super Table 3.0.9
Webhooks 3.0.4
Webhook Scheduler 1.1.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the steps in the issue: create an entry on Site A, add disabled Site B to a draft, and apply it. Start at the draft-application path and inspect where UnsupportedSiteException is raised. Done means the draft applies without an internal server error while preserving Site B as disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.