Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -30,8 +30,9 @@
<PackageReference Include="OrchardCore.ContentManagement" />
<PackageReference Include="OrchardCore.ContentTypes.Abstractions" />
<PackageReference Include="OrchardCore.DisplayManagement" />
<PackageReference Include="OrchardCoreContrib.Abstractions" />
<PackageReference Include="OrchardCore.ResourceManagement" />
<PackageReference Include="OrchardCoreContrib.Abstractions" />
<PackageReference Include="OrchardCoreContrib.Infrastructure.Abstractions" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using OrchardCore.Environment.Shell;
using OrchardCoreContrib.Contents.Indexes;
using OrchardCoreContrib.Contents.Models;
using Parlot.Fluent;
using OrchardCoreContrib.Infrastructure;
using YesSql;

namespace OrchardCoreContrib.Contents.Services;
Expand All @@ -16,7 +16,7 @@ public class SharedDraftLinkService(
{
public async Task<string> GenerateLinkAsync(string contentItemId)
{
ArgumentException.ThrowIfNullOrEmpty(contentItemId);
Guard.ArgumentNotNullOrEmpty(contentItemId, nameof(contentItemId));

var existingLink = await session.Query<SharedDraftLink, SharedDraftLinkIndex>()
.Where(l => l.ContentItemId == contentItemId && l.ExpirationUtc > DateTime.UtcNow)
Expand Down Expand Up @@ -44,7 +44,7 @@ public async Task<string> GenerateLinkAsync(string contentItemId)

public string GetGeneratedLink(string token)
{
ArgumentException.ThrowIfNullOrEmpty(token);
Guard.ArgumentNotNullOrEmpty(token, nameof(token));

var tenant = shellSettings.RequestUrlPrefix;
var baseUrl = $"{httpContextAccessor.HttpContext.Request.Scheme}://{httpContextAccessor.HttpContext.Request.Host}";
Expand All @@ -56,7 +56,7 @@ public string GetGeneratedLink(string token)

public async Task<ContentItem> GetDraftContentAsync(string token)
{
ArgumentException.ThrowIfNullOrEmpty(token);
Guard.ArgumentNotNullOrEmpty(token, nameof(token));

var link = await session.Query<SharedDraftLink, SharedDraftLinkIndex>()
.Where(l => l.Token == token && l.ExpirationUtc > DateTime.UtcNow)
Expand All @@ -83,6 +83,8 @@ public async Task<int> CleanupExpiredLinksAsync()

public async Task<bool> RevokeLinkAsync(string contentItemId)
{
Guard.ArgumentNotNullOrEmpty(contentItemId, nameof(contentItemId));

var link = await session.Query<SharedDraftLink, SharedDraftLinkIndex>()
.Where(l => l.ContentItemId == contentItemId && l.ExpirationUtc > DateTime.UtcNow)
.FirstOrDefaultAsync();
Expand All @@ -102,7 +104,7 @@ public async Task<bool> RevokeLinkAsync(string contentItemId)

public async Task<SharedDraftLink> GetActiveLinkAsync(string contentItemId)
{
ArgumentException.ThrowIfNullOrEmpty(contentItemId);
Guard.ArgumentNotNullOrEmpty(contentItemId, nameof(contentItemId));

return await session.Query<SharedDraftLink, SharedDraftLinkIndex>()
.Where(l => l.ContentItemId == contentItemId && l.ExpirationUtc > DateTime.UtcNow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<PackageReference Include="OrchardCore.Module.Targets" />
<PackageReference Include="OrchardCore.Users" />
<PackageReference Include="OrchardCoreContrib.Abstractions" />
<PackageReference Include="OrchardCoreContrib.Infrastructure.Abstractions" />
</ItemGroup>

</Project>
6 changes: 2 additions & 4 deletions src/OrchardCoreContrib.Gravatar/Services/GravatarService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Options;
using OrchardCoreContrib.Infrastructure;
using System.ComponentModel.DataAnnotations;
using System.Security.Cryptography;
using System.Text;
Expand All @@ -13,10 +14,7 @@ public class GravatarService(IOptions<GravatarOptions> gravatarOptions) : IGrava

public string GetAvatarUrl(string email, [Range(1, 512)] int size = GravatarConstants.DefaultSize)
{
if (string.IsNullOrEmpty(email))
{
throw new ArgumentException($"'{nameof(email)}' cannot be null or empty.", nameof(email));
}
Guard.ArgumentNotNullOrEmpty(email, nameof(email));

var hash = ComputeHash(email);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using OrchardCore.ContentManagement.Routing;
using OrchardCore.Settings;
using OrchardCore.Users;
using OrchardCoreContrib.Infrastructure;
using OrchardCoreContrib.System.Services;

namespace Microsoft.AspNetCore.Builder;
Expand All @@ -24,7 +25,7 @@ public static class ApplicationBuilderExtensions
/// <exception cref="ArgumentNullException">Thrown if <paramref name="app"/> is null.</exception>
public static IApplicationBuilder UseMaintenanceRedirect(this IApplicationBuilder app)
{
ArgumentNullException.ThrowIfNull(app);
Guard.ArgumentNotNull(app, nameof(app));

var siteService = app.ApplicationServices.GetService<ISiteService>();
var adminOptions = app.ApplicationServices.GetService<IOptions<AdminOptions>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<PackageReference Include="OrchardCore.DisplayManagement" />
<PackageReference Include="OrchardCoreContrib.HealthChecks.Abstractions" />
<PackageReference Include="OrchardCore.Users.Abstractions" />
<PackageReference Include="OrchardCoreContrib.Infrastructure.Abstractions" />
<PackageReference Include="OrchardCoreContrib.Abstractions" />
<PackageReference Include="OrchardCoreContrib.Navigation.Core" />
</ItemGroup>
Expand Down
Loading