statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
3.9k stars 520 forks source link

Duplicate in multisite adds drafts even when the page hasn't been added to the other sites. #9008

Closed DanielDarrenJones closed 2 months ago

DanielDarrenJones commented 10 months ago

Bug description

When duplicating an entry which is only enabled on certain sites drafts are created for every site, this makes the entry show when you change to the other sites in the collection when it shouldn't.

Screenshot 2023-11-16 at 15 46 13 Screenshot 2023-11-16 at 15 46 57

How to reproduce

On a multisite install:

  1. Create an entry and leave it as not enabled on some sites
  2. Duplicate the Entry
  3. The entry will have drafts created for all of the sites (even the ones which aren't enabled)

Logs

No response

Environment

Environment
Application Name: Example
Laravel Version: 10.32.1
PHP Version: 8.2.11
Composer Version: 2.5.5
Environment: local
Debug Mode: ENABLED
URL: example.test/
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 4
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.34.0 PRO

Statamic Addons
doefom/currency-fieldtype: 1.2.2
jacksleight/statamic-bard-texstyle: 3.1.3
ndx/statamic-bard-color-picker: 1.2.0
withcandour/aardvark-seo: 3.0.0

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

None

Additional details

No response

duncanmcclean commented 10 months ago

I believe this is intentional. The Duplicator action will localize the duplicated entry into all sites the user has access to.

Obviously they won't be published in those other sites until you manually go in and publish them.

DanielDarrenJones commented 10 months ago

@duncanmcclean the issue here is that it makes the entries show in every site, which when you have a large number of entries can be confusing. Surely it would make more sense to match the exact setup of the page you are duplicating?

jasonvarga commented 10 months ago

If this is happening, it's a bug.

It should only duplicate into the sites where the entry existed.

The test even states it: https://github.com/statamic/cms/blob/ce8e80987e29c8929364dc8387cd0f2399128202/tests/Actions/DuplicateEntryTest.php#L232

DanielDarrenJones commented 10 months ago

After digging further on this and trying to replicate in a fresh environment it looks like the propagate setting in the collection is what causes this - I'm not sure that the duplicate action should also propagate (I would think these should be separate things) but disabling this solved the issues for us.

grantholle commented 10 months ago

I haven't tinkered with the propagation setting, but it sort of makes sense. When I duplicate an entry, my non-origin site gets 2 'duplications', one correct the other has a bad slug. But the origin thinks the extra duplicate is the right one for the origin until I delete it. I recorded a short video on its behavior.