umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.49k stars 2.69k forks source link

"Vary by culture" toggle missing for properties on document type #17111

Closed gab-trifork closed 1 month ago

gab-trifork commented 1 month ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

14.2.0

Bug summary

When configuring properties on a document type, the toggle to allow properties to vary by culture is missing.

(Downgrading to 14.1.2 makes the toggle come back)

Specifics

No response

Steps to reproduce

Set up a blank Umbraco project using dotnet new umbraco and follow the steps for adding culture varied content: https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/variants

When on the step To allow a property on the Document Type to be varied it will have to be enabled for the property: notice that there is no toggle for enabling "vary by culture" for the property.

Expected result / actual result

The toggle is there, letting me decide whether properties are variant or invariant

github-actions[bot] commented 1 month ago

Hi there @gab-trifork!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

iOvergaard commented 1 month ago

Hi @gab-trifork, this issue is serious, but I'm having difficulty reproducing it. The toggle should be shown as long as the document type itself is also marked as "Allow vary by culture" in the "Settings" tab:

image

Will you let me know if that works, please?

gab-trifork commented 1 month ago

Hello @iOvergaard

I have that enabled.

prop doc type
gab-trifork commented 1 month ago

Sorry, I have 2 Umbraco projects and it turns out I accidentally ran the incorrect one, generating a new project using dotnet new umbraco is in fact NOT enough to reproduce. I am trying to figure out where it is going wrong.

iOvergaard commented 1 month ago

Good and bad news at the same time, @gab-trifork. Do let me know what you figure out!

gab-trifork commented 1 month ago

@iOvergaard

Okay, so I have managed to do a minimal reproduction.

  1. dotnet new umbraco
  2. dotnet add package usync.complete
  3. dotnet run
  4. theres no vary by culture on the property

if you stop the server and delete the usync package again, the toggle will reappear

my deps:

<ItemGroup>
  <PackageReference Include="Umbraco.Cms" Version="14.2.0" />
  <PackageReference Include="uSync.Complete" Version="14.2.0" />
</ItemGroup>
iOvergaard commented 1 month ago

@gab-trifork great, I can certainly reproduce that. Thank you so much for the reproducible steps.

The variation toggle is gone when usync.complete is installed, and when you remove usync.complete and restart the server, it reappears. It's difficult diving into minified code coming from other libraries to see where it goes wrong. Still, I could see that they make more contexts available in the document type editor and I think they might be overriding some of the built-in services in that area.

usync.complete 14.2 was just released last week and this bug might have flown under their radar until now. Honestly, I would report it directly to them on their Github issues tracker and refer back to this thread.

The technical explanation is as follows: The UI component needs to know that the context bearing the token UMB_CONTENT_TYPE_WORKSPACE_CONTEXT has an observable property called variesByCulture which gets set when you activate the corresponding toggle in the "Settings" tab in normal circumstances. Otherwise, the variation toggle won't show up for properties.

gab-trifork commented 1 month ago

@iOvergaard Thanks for the quick responses, and sorry for the inconvenience - had I noticed it only happened with uSync I would have opened the issue there instead.

iOvergaard commented 1 month ago

It's fine, @gab-trifork. Cheers!

KevinJump commented 1 month ago

Hi,

We've tracked this down in the uSync.Complete code, for reference (and maybe as a place to look if it happens with someone else). we had a missing condition.

as in we had a workspace context manifest that didn't limit the workspace context by condition.

const context: ManifestWorkspaceContext = {
    type: 'workspaceContext',
    alias: 'usync.publisher.server.workspace.context',
    name: 'Publisher workspace context',
    js: () => import('./server-workspace.context'),
};

we added the correct condition and that fixed is.

const context: ManifestWorkspaceContext = {
    type: 'workspaceContext',
    alias: 'usync.publisher.server.workspace.context',
    name: 'Publisher workspace context',
    js: () => import('./server-workspace.context'),
    conditions: [
        {
            alias: 'Umb.Condition.WorkspaceAlias',
            match: USYNC_PUBLISHER_SERVER_WORKSPACE_ALIAS,
        },
    ],
};

the context itself is not doing anything 'suspicious' (not from my eyes anyway). so not 100% sure why it breaks this and only this bit of the datatype but that does look like what it was doing 🤷

iOvergaard commented 1 month ago

Hi @KevinJump

I'm amazed by your investigation skills - great find. I'm not sure why that would have an effect, but I did see the publisher* contexts (by placing a <umb-debug> element in there in the browser) in the property create/edit dialog coming out of usync alongside the document type context from the Umbraco core. I didn't think they would take precedence for this property. Thanks for getting back to us with your findings!