diff --git a/README.md b/README.md index b3fd6a4..7359d19 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ The `OrchardCoreContrib.Modules` repository consists of the following modules: | [Content Localization Module](src/OrchardCoreContrib.ContentLocalization/README.md) | `OrchardCoreContrib.ContentLocalization` | [![NuGet](https://img.shields.io/nuget/v/OrchardCoreContrib.ContentLocalization.svg)](https://www.nuget.org/packages/OrchardCoreContrib.ContentLocalization) | | [Content Preview Module](src/OrchardCoreContrib.ContentPreview/README.md) | `OrchardCoreContrib.ContentPreview` | [![NuGet](https://img.shields.io/nuget/v/OrchardCoreContrib.ContentPreview.svg)](https://www.nuget.org/packages/OrchardCoreContrib.ContentPreview) | | [Content Permissions Module](src/OrchardCoreContrib.ContentPermissions/README.md) | `OrchardCoreContrib.Permissions` | [![NuGet](https://img.shields.io/nuget/v/OrchardCoreContrib.ContentPermissions.svg)](https://www.nuget.org/packages/OrchardCoreContrib.ContentPermissions) | +| [Contents Module](src/OrchardCoreContrib.Contents/README.md) | `OrchardCoreContrib.Contents` | [![NuGet](https://img.shields.io/nuget/v/OrchardCoreContrib.Contents.svg)](https://www.nuget.org/packages/OrchardCoreContrib.Contents) | | [Data Localization Module](src/OrchardCoreContrib.DataLocalization/README.md) | `OrchardCoreContrib.DataLocalization` | [![NuGet](https://img.shields.io/nuget/v/OrchardCoreContrib.DataLocalization.svg)](https://www.nuget.org/packages/OrchardCoreContrib.DataLocalization) | | [Elm Diagnostics Module](src/OrchardCoreContrib.Diagnostics.Elm/README.md) | `OrchardCoreContrib.Diagnostics.Elm` | [![NuGet](https://img.shields.io/nuget/v/OrchardCoreContrib.Diagnostics.Elm.svg)](https://www.nuget.org/packages/OrchardCoreContrib.Diagnostics.Elm) | | [Gmail Module](src/OrchardCoreContrib.Email.Gmail/README.md) | `OrchardCoreContrib.Email.Gmail` | [![NuGet](https://img.shields.io/nuget/v/OrchardCoreContrib.Email.Gmail.svg)](https://www.nuget.org/packages/OrchardCoreContrib.Email.Gmail) | diff --git a/src/OrchardCoreContrib.Contents/Manifest.cs b/src/OrchardCoreContrib.Contents/Manifest.cs index 9e5a58c..3662a81 100644 --- a/src/OrchardCoreContrib.Contents/Manifest.cs +++ b/src/OrchardCoreContrib.Contents/Manifest.cs @@ -5,7 +5,7 @@ Name = "Contents", Author = ManifestConstants.Author, Website = ManifestConstants.Website, - Version = "1.0.0", + Version = "1.0.1", Category = "Content Management" )] diff --git a/src/OrchardCoreContrib.Contents/Migrations.cs b/src/OrchardCoreContrib.Contents/Migrations.cs index 577d38f..7a0b427 100644 --- a/src/OrchardCoreContrib.Contents/Migrations.cs +++ b/src/OrchardCoreContrib.Contents/Migrations.cs @@ -1,10 +1,11 @@ using OrchardCore.Data.Migration; +using OrchardCore.Environment.Shell; using OrchardCoreContrib.Contents.Indexes; using YesSql.Sql; namespace OrchardCoreContrib.Contents; -public class Migrations : DataMigration +public class Migrations(IShellFeaturesManager shellFeaturesManager) : DataMigration { public async Task CreateAsync() { @@ -17,8 +18,24 @@ await SchemaBuilder.CreateMapIndexTableAsync(table => tabl .Column("CreatedUtc") ); + return 1; + } + + public async Task UpdateFrom1Async() + { + var features = await shellFeaturesManager.GetEnabledFeaturesAsync(); + + if (!features.Any(f => f.Id == "OrchardCore.Notifications")) + { + await SchemaBuilder.AlterIndexTableAsync(table => + { + table.DropIndex("IDX_NotificationIndex_DocumentId"); + table.DropIndex("IDX_NotificationIndex_CreatedBy"); + }); + } + await SchemaBuilder.AlterIndexTableAsync(table => table - .CreateIndex("IDX_NotificationIndex_DocumentId", + .CreateIndex("IDX_SharedDraftLinkIndex_DocumentId", "DocumentId", "LinkId", "ContentItemId", @@ -29,13 +46,13 @@ await SchemaBuilder.AlterIndexTableAsync(table => table ); await SchemaBuilder.AlterIndexTableAsync(table => table - .CreateIndex("IDX_NotificationIndex_CreatedBy", + .CreateIndex("IDX_SharedDraftLinkIndex_CreatedBy", "DocumentId", "ContentItemId", "CreatedBy", "CreatedUtc") ); - return 1; + return 2; } } diff --git a/src/OrchardCoreContrib.Contents/OrchardCoreContrib.Contents.csproj b/src/OrchardCoreContrib.Contents/OrchardCoreContrib.Contents.csproj index fb2a084..5a72fb9 100644 --- a/src/OrchardCoreContrib.Contents/OrchardCoreContrib.Contents.csproj +++ b/src/OrchardCoreContrib.Contents/OrchardCoreContrib.Contents.csproj @@ -2,10 +2,10 @@ true - 1.0.0 + 1.0.1 The Orchard Core Contrib Team - Provides features related to content management. + Provides features related to content management, including share draft contents. README.md BSD-3-Clause https://github.com/OrchardCoreContrib/OrchardCoreContrib.Modules/tree/main/src/OrchardCoreContrib.Contents/README.md diff --git a/src/OrchardCoreContrib.Contents/README.md b/src/OrchardCoreContrib.Contents/README.md index f9a738f..4b2cbe1 100644 --- a/src/OrchardCoreContrib.Contents/README.md +++ b/src/OrchardCoreContrib.Contents/README.md @@ -24,8 +24,9 @@ This module has no dependencies. ## NuGet Packages -| Name | Version | -|---------------------------------------------------------------------------------------------------------------------|-------------| +| Name | Version | +|---------------------------------------------------------------------------------------------------------|-------------| +| [`OrchardCoreContrib.Contents`](https://www.nuget.org/packages/OrchardCoreContrib.Contents/1.0.1) | 1.0.1 | | [`OrchardCoreContrib.Contents`](https://www.nuget.org/packages/OrchardCoreContrib.Contents/1.0.0) | 1.0.0 | ## Get Started diff --git a/src/OrchardCoreContrib.Contents/Views/Content_ShareDraftButton.cshtml b/src/OrchardCoreContrib.Contents/Views/Content_ShareDraftButton.cshtml index ff9cbf4..d6368c1 100644 --- a/src/OrchardCoreContrib.Contents/Views/Content_ShareDraftButton.cshtml +++ b/src/OrchardCoreContrib.Contents/Views/Content_ShareDraftButton.cshtml @@ -3,7 +3,9 @@ @using OrchardCoreContrib.Contents.ViewModels @model SharedDraftLinkViewModel @inject IAuthorizationService AuthorizationService - +@{ + var dateDiff = Model.Link.ExpirationUtc - DateTime.UtcNow; +}

- Expires in + @if (dateDiff <= TimeSpan.Zero) + { + @T["Expired"] + } + else + { + var days = (int)Math.Round(dateDiff.TotalDays); + @T["Expires in {0} day(s)", days] + }

@@ -39,25 +49,8 @@