Browse Source

Merge branch 'dev' into cotur/cms-kit

pull/6875/head
Ahmet 6 years ago
parent
commit
59eb402f07
  1. 5
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs
  2. 29
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/PagesFeature.cs
  3. 11
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs
  4. 30
      modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Features/GlobalCmsKitFeatures_Tests.cs

5
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs

@ -15,6 +15,10 @@ namespace Volo.CmsKit.GlobalFeatures
public TagsFeature Tags => GetFeature<TagsFeature>();
public ContentsFeature Contents => GetFeature<ContentsFeature>();
public PagesFeature Pages => GetFeature<PagesFeature>();
public GlobalCmsKitFeatures([NotNull] GlobalFeatureManager featureManager)
: base(featureManager)
{
@ -23,6 +27,7 @@ namespace Volo.CmsKit.GlobalFeatures
AddFeature(new RatingsFeature(this));
AddFeature(new TagsFeature(this));
AddFeature(new ContentsFeature(this));
AddFeature(new PagesFeature(this));
}
}
}

29
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/PagesFeature.cs

@ -0,0 +1,29 @@
using JetBrains.Annotations;
using Volo.Abp.GlobalFeatures;
namespace Volo.CmsKit.GlobalFeatures
{
[GlobalFeatureName(Name)]
public class PagesFeature:GlobalFeature
{
public const string Name = "CmsKit.Pages";
internal PagesFeature(
[NotNull] GlobalCmsKitFeatures cmsKit
) : base(cmsKit)
{
}
public override void Enable()
{
var contentsFeature = FeatureManager.Modules.CmsKit().Contents;
if (!contentsFeature.IsEnabled)
{
contentsFeature.Enable();
}
base.Enable();
}
}
}

11
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs

@ -69,12 +69,11 @@ namespace Volo.CmsKit.MongoDB.Tags
.Select(q => q.TagId)
.ToListAsync(cancellationToken: GetCancellationToken(cancellationToken));
var query = await Collection.FindAsync(Builders<Tag>.Filter.And(new[]
{
Builders<Tag>.Filter.Eq(x =>x.EntityType, entityType),
Builders<Tag>.Filter.Eq(x =>x.TenantId, tenantId),
Builders<Tag>.Filter.In(x => x.Id, entityTagIds),
}));
var query = GetMongoQueryable()
.Where(x =>
x.EntityType == entityType &&
x.TenantId == tenantId &&
entityTagIds.Contains(x.Id));
var result = await query.ToListAsync(cancellationToken: GetCancellationToken(cancellationToken));
return result;

30
modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Features/GlobalCmsKitFeatures_Tests.cs

@ -0,0 +1,30 @@
using Shouldly;
using Volo.Abp.GlobalFeatures;
using Volo.CmsKit.GlobalFeatures;
using Xunit;
namespace Volo.CmsKit.Features
{
public class GlobalCmsKitFeatures_Tests : CmsKitDomainTestBase
{
private readonly GlobalCmsKitFeatures _cmsKitFeatures;
public GlobalCmsKitFeatures_Tests()
{
_cmsKitFeatures = new GlobalCmsKitFeatures(GlobalFeatureManager.Instance);
}
[Fact]
public void Page_Feature_Should_Enable_Dependent_Features()
{
_cmsKitFeatures.DisableAll();
_cmsKitFeatures.Contents.IsEnabled.ShouldBeFalse();
_cmsKitFeatures.Pages.IsEnabled.ShouldBeFalse();
_cmsKitFeatures.Pages.Enable();
_cmsKitFeatures.Contents.IsEnabled.ShouldBeTrue();
_cmsKitFeatures.Pages.IsEnabled.ShouldBeTrue();
}
}
}
Loading…
Cancel
Save