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.45k stars 2.68k forks source link

TourFilters AddFilterByFile does not work in Umbraco 10 #12667

Closed sofietoft closed 2 years ago

sofietoft commented 2 years ago

Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9

10.0.0

Bug summary

In our Backoffice Tours documentation, we have a section on how to filter tours based on a set of different things.

The AddFilterByFile option does not work on Umbraco 10.

Specifics

No response

Steps to reproduce

using System.Text.RegularExpressions;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Tour;

namespace Umbraco.Docs.Samples.Web.BackofficeTours
{
    public class BackofficeComposer : IComposer
    {
        public void Compose(IUmbracoBuilder builder)
        {
            builder.TourFilters()
                .AddFilterByFile("custom-tours.json");
        }
    }
}

Expected result / actual result

The expected result would be that the tour does not show up in the backoffice. However, the actual result is, that it actually does show up in the backoffice.

This has been tested multiple times in a v10 project.


_This item has been added to our backlog AB#22248_

bergmania commented 2 years ago

Thanks for reporting.. I see that, currently the AddFilterByFile does not expect the file extension. Ill figure out if this is the same in v8. If so, then I guess it is the documentation that is wrong. If it requires the extension in v8, then I'll fix in the codebase for v10

bergmania commented 2 years ago

Alright, In v7+v8 this has been the same, at least since 27/03/2018. So I think it is better to update the docs to not expect the file extension.

In your case, try this composer instead

using System.Text.RegularExpressions; using Umbraco.Cms.Core.Composing; using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.Tour;

namespace Umbraco.Docs.Samples.Web.BackofficeTours
{
    public class BackofficeComposer : IComposer
    {
        public void Compose(IUmbracoBuilder builder)
        {
            builder.TourFilters()
                .AddFilterByFile("custom-tours");
        }
    }
}

Please confirm this also works for you. If so, I recommend to update the docs for all versions

bergmania commented 2 years ago

Ill close this, and follow up on docs

bergmania commented 2 years ago

Docs updated