Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-751: Upgrade to Orchard Core 1.8 #106

Merged
merged 27 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5c282ed
Upgrading to .NET 8 and OC 1.8.2
Psichorex Jan 18, 2024
d12a9f2
Addressing warnings.
Psichorex Jan 19, 2024
5addb2e
Addressing warnings.
Psichorex Jan 20, 2024
d514b83
Fixing.
Psichorex Jan 28, 2024
5a47e81
Keeping T.
Psichorex Jan 29, 2024
856c0fb
Keeping T.
Psichorex Jan 29, 2024
16918b8
Removing fields.
Psichorex Jan 29, 2024
1597f4c
Keeping H.
Psichorex Jan 29, 2024
8dea136
Adding comment.
Psichorex Jan 29, 2024
3e9780d
Adding comment.
Psichorex Jan 29, 2024
f8f8e01
Merge remote-tracking branch 'origin/dev' into issue/OSOE-751
Psichorex Jan 30, 2024
71ca884
Revert "Addressing warnings."
Psichorex Jan 30, 2024
6253c59
Fixes.
Psichorex Jan 30, 2024
98f029c
Fixes.
Psichorex Jan 30, 2024
e4c85a7
Removing workaround.
Psichorex Jan 30, 2024
53112a5
Update Lombiq.Hosting.Tenants.Management/Filters/ForbiddenTenantsFilt…
Psichorex Feb 1, 2024
6c17a34
Minor fixing.
Psichorex Feb 1, 2024
9837aa1
Merge remote-tracking branch 'origin/dev' into issue/OSOE-751
Piedone Feb 5, 2024
1269e6e
Upgrading MS package.
Psichorex Feb 6, 2024
198405f
Merge branch 'issue/OSOE-751' of https://github.com/Lombiq/Hosting-Te…
Psichorex Feb 6, 2024
215068a
Merge remote-tracking branch 'origin/dev' into issue/OSOE-751
Psichorex Feb 13, 2024
72f87fa
Using issue branch reference.
Psichorex Feb 16, 2024
aab34c3
Using alpha.
Psichorex Feb 17, 2024
697fae6
Using alphas.
Psichorex Feb 18, 2024
97cc946
Updating UITT alpha.
Psichorex Feb 20, 2024
ef7c66d
Using new UITT alpha.
Psichorex Feb 21, 2024
37cd30c
Reverting to dev reference.
Psichorex Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using OrchardCore.Modules;
using OrchardCore.Settings;
using OrchardCore.Users;
using System;
using System.Linq;
using System.Threading.Tasks;
using static Lombiq.Hosting.Tenants.Admin.Login.Constants.FeatureNames;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using OrchardCore.DisplayManagement.Layout;
using OrchardCore.Environment.Shell;
using OrchardCore.Environment.Shell.Models;
using OrchardCore.Modules;
using OrchardCore.Mvc.Core.Utilities;
using OrchardCore.Tenants.Controllers;
using System;
using System.Threading.Tasks;

namespace Lombiq.Hosting.Tenants.Admin.Login.Filters;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**;Tests\**</DefaultItemExcludes>
</PropertyGroup>
Expand Down Expand Up @@ -34,10 +34,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.7.0" />
<PackageReference Include="OrchardCore.Tenants" Version="1.7.0" />
<PackageReference Include="OrchardCore.Users" Version="1.7.0" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.8.2" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.8.2" />
<PackageReference Include="OrchardCore.Tenants" Version="1.8.2" />
<PackageReference Include="OrchardCore.Users" Version="1.8.2" />
</ItemGroup>

<ItemGroup Condition="'$(NuGetBuild)' != 'true'">
Expand Down
2 changes: 1 addition & 1 deletion Lombiq.Hosting.Tenants.Admin.Login/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Description = "Ability to log in as a tenant’s admin user.",
Category = "Hosting",
DefaultTenantOnly = true,
Dependencies = new[] { "OrchardCore.Tenants" }
Dependencies = ["OrchardCore.Tenants"]
)]

[assembly: Feature(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**</DefaultItemExcludes>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**</DefaultItemExcludes>
</PropertyGroup>
Expand Down Expand Up @@ -34,16 +34,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OrchardCore.Admin" Version="1.7.0" />
<PackageReference Include="OrchardCore.Email.Core" Version="1.7.0" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.7.0" />
<PackageReference Include="OrchardCore.AdminDashboard" Version="1.7.0" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.ResourceManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.Email.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.Infrastructure.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.Admin" Version="1.8.2" />
<PackageReference Include="OrchardCore.Email.Core" Version="1.8.2" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.8.2" />
<PackageReference Include="OrchardCore.AdminDashboard" Version="1.8.2" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.8.2" />
<PackageReference Include="OrchardCore.ResourceManagement" Version="1.8.2" />
<PackageReference Include="OrchardCore.Email.Abstractions" Version="1.8.2" />
<PackageReference Include="OrchardCore.Infrastructure.Abstractions" Version="1.8.2" />
<PackageReference Include="Scrutor" Version="4.2.2" />
<PackageReference Include="YesSql.Abstractions" Version="3.3.0" />
<PackageReference Include="YesSql.Abstractions" Version="4.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(NuGetBuild)' != 'true'">
Expand Down
6 changes: 3 additions & 3 deletions Lombiq.Hosting.Tenants.EmailQuotaManagement/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
Name = "Lombiq Hosting - Tenants Email Quota Management",
Category = "Hosting",
IsAlwaysEnabled = true,
Dependencies = new[]
{
Dependencies =
[
"OrchardCore.Emails",
"Lombiq.HelpfulExtensions.Emails",
}
]
)]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OrchardCore.Data.Migration;
using System.Threading.Tasks;

namespace Lombiq.Hosting.Tenants.EmailQuotaManagement.Migrations;

Expand All @@ -14,19 +15,19 @@ public class EmailQuotaMigrations : DataMigration
#pragma warning restore CA1822 // Mark members as static
#pragma warning restore IDE0079 // Remove unnecessary suppression

public int UpdateFrom1()
public async Task<int> UpdateFrom1Async()
{
SchemaBuilder.AlterTable("EmailQuotaIndex", table => table
await SchemaBuilder.AlterTableAsync("EmailQuotaIndex", table => table
.AddColumn<int>("LastReminderPercentage")
);

return 2;
}

public int UpdateFrom2()
public async Task<int> UpdateFrom2Async()
{
// Deleting index because it is not needed.
SchemaBuilder.DropTable("EmailQuotaIndex");
await SchemaBuilder.DropTableAsync("EmailQuotaIndex");

return 3;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.BackgroundTasks;
using System;
using System.Threading;
Expand All @@ -15,6 +15,6 @@ public async Task DoWorkAsync(IServiceProvider serviceProvider, CancellationToke
{
var emailQuotaService = serviceProvider.GetRequiredService<IEmailQuotaService>();
var currentQuota = await emailQuotaService.GetOrCreateCurrentQuotaAsync();
emailQuotaService.ResetQuota(currentQuota);
await emailQuotaService.ResetQuotaAsync(currentQuota);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Lombiq.Hosting.Tenants.EmailQuotaManagement.Models;
using Lombiq.Hosting.Tenants.EmailQuotaManagement.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
Expand Down Expand Up @@ -91,22 +91,22 @@ public async Task<EmailQuota> GetOrCreateCurrentQuotaAsync()
// Need to set default value otherwise the database might complain about being 01/01/0001 out of range.
LastReminderUtc = _clock.UtcNow.AddMonths(-1),
};
_session.Save(currentQuota);
await _session.SaveAsync(currentQuota);

return currentQuota;
}

public void IncreaseEmailUsage(EmailQuota emailQuota)
public Task IncreaseEmailUsageAsync(EmailQuota emailQuota)
{
emailQuota.CurrentEmailUsageCount++;
_session.Save(emailQuota);
return _session.SaveAsync(emailQuota);
}

public void SetQuotaOnEmailReminder(EmailQuota emailQuota)
public Task SetQuotaOnEmailReminderAsync(EmailQuota emailQuota)
{
emailQuota.LastReminderUtc = _clock.UtcNow;
emailQuota.LastReminderPercentage = emailQuota.CurrentUsagePercentage(GetEmailQuotaPerMonth());
_session.Save(emailQuota);
return _session.SaveAsync(emailQuota);
}

public bool ShouldSendReminderEmail(EmailQuota emailQuota, int currentUsagePercentage)
Expand All @@ -128,10 +128,10 @@ public bool ShouldSendReminderEmail(EmailQuota emailQuota, int currentUsagePerce
emailQuota.LastReminderPercentage >= 100);
}

public void ResetQuota(EmailQuota emailQuota)
public Task ResetQuotaAsync(EmailQuota emailQuota)
{
emailQuota.CurrentEmailUsageCount = 0;
_session.Save(emailQuota);
return _session.SaveAsync(emailQuota);
}

public int GetEmailQuotaPerMonth() =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Lombiq.Hosting.Tenants.EmailQuotaManagement.Models;
using Lombiq.Hosting.Tenants.EmailQuotaManagement.Models;
using System.Collections.Generic;
using System.Threading.Tasks;

Expand Down Expand Up @@ -34,20 +34,20 @@ public interface IEmailQuotaService
/// <summary>
/// Increases the usage count of the given <paramref name="emailQuota"/> and saves it to the database.
/// </summary>
void IncreaseEmailUsage(EmailQuota emailQuota);
Task IncreaseEmailUsageAsync(EmailQuota emailQuota);

/// <summary>
/// Resets the given <paramref name="emailQuota"/> <see cref="EmailQuota.CurrentEmailUsageCount"/> to 0 and saves it
/// to the database.
/// </summary>
void ResetQuota(EmailQuota emailQuota);
Task ResetQuotaAsync(EmailQuota emailQuota);

/// <summary>
/// Sets the <see cref="EmailQuota.LastReminderUtc"/> to the current date and
/// <see cref="EmailQuota.LastReminderPercentage"/> to the current email quota usage percentage then saves it to the
/// database.
/// </summary>
void SetQuotaOnEmailReminder(EmailQuota emailQuota);
Task SetQuotaOnEmailReminderAsync(EmailQuota emailQuota);

/// <summary>
/// Returns <see langword="true"/>, if the reminder email should be sent.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Lombiq.HelpfulExtensions.Extensions.Emails.Services;
using Lombiq.HelpfulExtensions.Extensions.Emails.Services;
using Lombiq.Hosting.Tenants.EmailQuotaManagement.Models;
using Microsoft.Extensions.Localization;
using OrchardCore.Email;
Expand Down Expand Up @@ -54,7 +54,7 @@ public async Task<SmtpResult> SendAsync(MailMessage message)
var emailResult = await _smtpService.SendAsync(message);
if (emailResult == SmtpResult.Success)
{
_emailQuotaService.IncreaseEmailUsage(isQuotaOverResult.EmailQuota);
await _emailQuotaService.IncreaseEmailUsageAsync(isQuotaOverResult.EmailQuota);
}

return emailResult;
Expand All @@ -68,7 +68,7 @@ private async Task SendAlertEmailIfNecessaryAsync(EmailQuota emailQuota)
var siteOwnerEmails = (await _emailQuotaService.GetUserEmailsForEmailReminderAsync()).ToList();
if (currentUsagePercentage >= 100)
{
SendQuotaEmail(
await SendQuotaEmailAsync(
emailQuota,
siteOwnerEmails,
"EmailQuotaExceededError",
Expand All @@ -77,15 +77,15 @@ private async Task SendAlertEmailIfNecessaryAsync(EmailQuota emailQuota)
return;
}

SendQuotaEmail(
await SendQuotaEmailAsync(
emailQuota,
siteOwnerEmails,
$"EmailQuotaWarning",
_emailQuotaSubjectService.GetWarningEmailSubject(currentUsagePercentage),
currentUsagePercentage);
}

private void SendQuotaEmail(
private Task SendQuotaEmailAsync(
EmailQuota emailQuota,
IEnumerable<string> siteOwnerEmails,
string emailTemplateName,
Expand Down Expand Up @@ -113,6 +113,6 @@ private void SendQuotaEmail(
});
}

_emailQuotaService.SetQuotaOnEmailReminder(emailQuota);
return _emailQuotaService.SetQuotaOnEmailReminderAsync(emailQuota);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**</DefaultItemExcludes>
</PropertyGroup>
Expand Down Expand Up @@ -34,8 +34,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OrchardCore.Infrastructure.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.7.0" />
<PackageReference Include="OrchardCore.ResourceManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.Infrastructure.Abstractions" Version="1.8.2" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.8.2" />
<PackageReference Include="OrchardCore.ResourceManagement" Version="1.8.2" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**</DefaultItemExcludes>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private Task HandleConditionallyEnabledFeaturesAsync()
throw new InvalidOperationException("'IsAlwaysEnabled' feature can't be disabled by FeaturesGuard.");
}

if (!featuresToEnable.Any() && !featuresToDisable.Any())
if (featuresToEnable.Count == 0 && featuresToDisable.Count == 0)
{
return;
}
Expand All @@ -119,7 +119,7 @@ private Task HandleConditionallyEnabledFeaturesAsync()
/// </returns>
private static bool TryGetFeaturesToBeEnabledAndDisabled(
IDictionary<string, IEnumerable<string>> conditionallyEnabledFeatures,
IReadOnlySet<string> enabledFeatureIds,
HashSet<string> enabledFeatureIds,
out HashSet<string> featuresToEnable,
out HashSet<string> featuresToDisable)
{
Expand Down Expand Up @@ -152,6 +152,6 @@ private static bool TryGetFeaturesToBeEnabledAndDisabled(
featuresToEnable = featuresToEnableIds;
featuresToDisable = featuresToDisableIds;

return featuresToEnableIds.Any() || featuresToDisableIds.Any();
return featuresToEnableIds.Count != 0 || featuresToDisableIds.Count != 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**</DefaultItemExcludes>
</PropertyGroup>
Expand Down Expand Up @@ -34,11 +34,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OrchardCore.Infrastructure.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.7.0" />
<PackageReference Include="OrchardCore.ContentManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.ContentTypes.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.Infrastructure.Abstractions" Version="1.8.2" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.8.2" />
<PackageReference Include="OrchardCore.ContentManagement" Version="1.8.2" />
<PackageReference Include="OrchardCore.ContentTypes.Abstractions" Version="1.8.2" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.8.2" />
</ItemGroup>

<ItemGroup Condition="'$(NuGetBuild)' != 'true'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand Down
Loading