Browse Source

cms-kit: commentUrl added

pull/16476/head
Onur Pıçakcı 3 years ago
parent
commit
35b0a2ddd5
  1. 2303
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20221216140823_Initial.Designer.cs
  2. 62
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20221223083811_Added_EntityVersion.cs
  3. 41
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20230503070601_Initial.Designer.cs
  4. 26
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20230503070601_Initial.cs
  5. 37
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs
  6. 9
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.css
  7. 1
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Comments/CommentConsts.cs
  8. 4
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/Comment.cs
  9. 2
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentManager.cs
  10. 1
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs
  11. 2
      modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentDto.cs
  12. 2
      modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CreateCommentInput.cs
  13. 2
      modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CreateCommentWithParametersInput.cs
  14. 1
      modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs
  15. 6
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml
  16. 3
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js
  17. 18
      modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs

2303
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20221216140823_Initial.Designer.cs

File diff suppressed because it is too large

62
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20221223083811_Added_EntityVersion.cs

@ -1,62 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Volo.CmsKit.Migrations
{
/// <inheritdoc />
public partial class AddedEntityVersion : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpUsers",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpTenants",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpRoles",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "EntityVersion",
table: "AbpOrganizationUnits",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpRoles");
migrationBuilder.DropColumn(
name: "EntityVersion",
table: "AbpOrganizationUnits");
}
}
}

41
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20221223083811_Added_EntityVersion.Designer.cs → modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20230503070601_Initial.Designer.cs

@ -13,8 +13,8 @@ using Volo.CmsKit.EntityFrameworkCore;
namespace Volo.CmsKit.Migrations namespace Volo.CmsKit.Migrations
{ {
[DbContext(typeof(UnifiedDbContext))] [DbContext(typeof(UnifiedDbContext))]
[Migration("20221223083811_Added_EntityVersion")] [Migration("20230503070601_Initial")]
partial class AddedEntityVersion partial class Initial
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -790,6 +790,9 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("uniqueidentifier") .HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId"); .HasColumnName("LastModifierId");
b.Property<DateTimeOffset?>("LastPasswordChangeTime")
.HasColumnType("datetimeoffset");
b.Property<bool>("LockoutEnabled") b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit") .HasColumnType("bit")
@ -838,6 +841,9 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("nvarchar(256)") .HasColumnType("nvarchar(256)")
.HasColumnName("SecurityStamp"); .HasColumnName("SecurityStamp");
b.Property<bool>("ShouldChangePasswordOnNextLogin")
.HasColumnType("bit");
b.Property<string>("Surname") b.Property<string>("Surname")
.HasMaxLength(64) .HasMaxLength(64)
.HasColumnType("nvarchar(64)") .HasColumnType("nvarchar(64)")
@ -900,6 +906,33 @@ namespace Volo.CmsKit.Migrations
b.ToTable("AbpUserClaims", (string)null); b.ToTable("AbpUserClaims", (string)null);
}); });
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("EndTime")
.HasColumnType("datetime2");
b.Property<Guid>("SourceUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("StartTime")
.HasColumnType("datetime2");
b.Property<Guid>("TargetUserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.ToTable("AbpUserDelegations", (string)null);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{ {
b.Property<Guid>("UserId") b.Property<Guid>("UserId")
@ -1557,6 +1590,10 @@ namespace Volo.CmsKit.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("CommentUrl")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasMaxLength(40) .HasMaxLength(40)

26
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20221216140823_Initial.cs → modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20230503070601_Initial.cs

@ -155,6 +155,7 @@ namespace Volo.CmsKit.Migrations
ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Code = table.Column<string>(type: "nvarchar(95)", maxLength: 95, nullable: false), Code = table.Column<string>(type: "nvarchar(95)", maxLength: 95, nullable: false),
DisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false), DisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
EntityVersion = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
@ -235,6 +236,7 @@ namespace Volo.CmsKit.Migrations
IsDefault = table.Column<bool>(type: "bit", nullable: false), IsDefault = table.Column<bool>(type: "bit", nullable: false),
IsStatic = table.Column<bool>(type: "bit", nullable: false), IsStatic = table.Column<bool>(type: "bit", nullable: false),
IsPublic = table.Column<bool>(type: "bit", nullable: false), IsPublic = table.Column<bool>(type: "bit", nullable: false),
EntityVersion = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true) ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
}, },
@ -289,6 +291,7 @@ namespace Volo.CmsKit.Migrations
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false), Name = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
EntityVersion = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
@ -304,6 +307,22 @@ namespace Volo.CmsKit.Migrations
table.PrimaryKey("PK_AbpTenants", x => x.Id); table.PrimaryKey("PK_AbpTenants", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "AbpUserDelegations",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
SourceUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TargetUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
EndTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserDelegations", x => x.Id);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "AbpUsers", name: "AbpUsers",
columns: table => new columns: table => new
@ -327,6 +346,9 @@ namespace Volo.CmsKit.Migrations
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true), LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), LockoutEnabled = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
AccessFailedCount = table.Column<int>(type: "int", nullable: false, defaultValue: 0), AccessFailedCount = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
ShouldChangePasswordOnNextLogin = table.Column<bool>(type: "bit", nullable: false),
EntityVersion = table.Column<int>(type: "int", nullable: false),
LastPasswordChangeTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
@ -400,6 +422,7 @@ namespace Volo.CmsKit.Migrations
RepliedCommentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), RepliedCommentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CommentUrl = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true) ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
}, },
@ -1232,6 +1255,9 @@ namespace Volo.CmsKit.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "AbpUserClaims"); name: "AbpUserClaims");
migrationBuilder.DropTable(
name: "AbpUserDelegations");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "AbpUserLogins"); name: "AbpUserLogins");

37
modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs

@ -787,6 +787,9 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("uniqueidentifier") .HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId"); .HasColumnName("LastModifierId");
b.Property<DateTimeOffset?>("LastPasswordChangeTime")
.HasColumnType("datetimeoffset");
b.Property<bool>("LockoutEnabled") b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit") .HasColumnType("bit")
@ -835,6 +838,9 @@ namespace Volo.CmsKit.Migrations
.HasColumnType("nvarchar(256)") .HasColumnType("nvarchar(256)")
.HasColumnName("SecurityStamp"); .HasColumnName("SecurityStamp");
b.Property<bool>("ShouldChangePasswordOnNextLogin")
.HasColumnType("bit");
b.Property<string>("Surname") b.Property<string>("Surname")
.HasMaxLength(64) .HasMaxLength(64)
.HasColumnType("nvarchar(64)") .HasColumnType("nvarchar(64)")
@ -897,6 +903,33 @@ namespace Volo.CmsKit.Migrations
b.ToTable("AbpUserClaims", (string)null); b.ToTable("AbpUserClaims", (string)null);
}); });
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("EndTime")
.HasColumnType("datetime2");
b.Property<Guid>("SourceUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("StartTime")
.HasColumnType("datetime2");
b.Property<Guid>("TargetUserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.ToTable("AbpUserDelegations", (string)null);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{ {
b.Property<Guid>("UserId") b.Property<Guid>("UserId")
@ -1554,6 +1587,10 @@ namespace Volo.CmsKit.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("CommentUrl")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasMaxLength(40) .HasMaxLength(40)

9
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.css

@ -1,3 +1,10 @@
.datatableCell{ .datatableCell{
cursor: pointer; cursor: pointer;
} }
a.copy-link {
display: inline-block !important;
}
a.copy-link {
display: none !important;
padding-left: 0.375em;
}

1
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Comments/CommentConsts.cs

@ -10,4 +10,5 @@ public static class CommentConsts
public static int MaxEntityIdLength { get; set; } = CmsEntityConsts.MaxEntityIdLength; public static int MaxEntityIdLength { get; set; } = CmsEntityConsts.MaxEntityIdLength;
public static int MaxTextLength { get; set; } = 512; public static int MaxTextLength { get; set; } = 512;
public static int MaxCommentUrlLength { get; set; } = 512;
} }

4
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/Comment.cs

@ -23,6 +23,8 @@ public class Comment : AggregateRoot<Guid>, IHasCreationTime, IMustHaveCreator,
public virtual DateTime CreationTime { get; set; } public virtual DateTime CreationTime { get; set; }
public virtual string CommentUrl { get; set; }
protected Comment() protected Comment()
{ {
@ -35,6 +37,7 @@ public class Comment : AggregateRoot<Guid>, IHasCreationTime, IMustHaveCreator,
[NotNull] string text, [NotNull] string text,
Guid? repliedCommentId, Guid? repliedCommentId,
Guid creatorId, Guid creatorId,
[CanBeNull] string commentUrl,
Guid? tenantId = null) Guid? tenantId = null)
: base(id) : base(id)
{ {
@ -42,6 +45,7 @@ public class Comment : AggregateRoot<Guid>, IHasCreationTime, IMustHaveCreator,
EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), CommentConsts.MaxEntityIdLength); EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), CommentConsts.MaxEntityIdLength);
RepliedCommentId = repliedCommentId; RepliedCommentId = repliedCommentId;
CreatorId = creatorId; CreatorId = creatorId;
CommentUrl = commentUrl;
TenantId = tenantId; TenantId = tenantId;
SetTextInternal(text); SetTextInternal(text);

2
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentManager.cs

@ -21,6 +21,7 @@ public class CommentManager : DomainService
[NotNull] string entityType, [NotNull] string entityType,
[NotNull] string entityId, [NotNull] string entityId,
[NotNull] string text, [NotNull] string text,
[CanBeNull] string commentUrl = null,
[CanBeNull] Guid? repliedCommentId = null) [CanBeNull] Guid? repliedCommentId = null)
{ {
Check.NotNull(creator, nameof(creator)); Check.NotNull(creator, nameof(creator));
@ -40,6 +41,7 @@ public class CommentManager : DomainService
text, text,
repliedCommentId, repliedCommentId,
creator.Id, creator.Id,
commentUrl,
CurrentTenant.Id); CurrentTenant.Id);
} }
} }

1
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs

@ -79,6 +79,7 @@ public static class CmsKitDbContextModelCreatingExtensions
b.Property(x => x.EntityId).IsRequired().HasMaxLength(CommentConsts.MaxEntityIdLength); b.Property(x => x.EntityId).IsRequired().HasMaxLength(CommentConsts.MaxEntityIdLength);
b.Property(x => x.Text).IsRequired().HasMaxLength(CommentConsts.MaxTextLength); b.Property(x => x.Text).IsRequired().HasMaxLength(CommentConsts.MaxTextLength);
b.Property(x => x.RepliedCommentId); b.Property(x => x.RepliedCommentId);
b.Property(x => x.CommentUrl).HasMaxLength(CommentConsts.MaxCommentUrlLength);
b.HasIndex(x => new { x.TenantId, x.EntityType, x.EntityId }); b.HasIndex(x => new { x.TenantId, x.EntityType, x.EntityId });
b.HasIndex(x => new { x.TenantId, x.RepliedCommentId }); b.HasIndex(x => new { x.TenantId, x.RepliedCommentId });

2
modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentDto.cs

@ -23,4 +23,6 @@ public class CommentDto : IHasConcurrencyStamp
public CmsUserDto Author { get; set; } //TODO: Should only have AuthorId for the basic dto. see https://docs.abp.io/en/abp/latest/Best-Practices/Application-Services public CmsUserDto Author { get; set; } //TODO: Should only have AuthorId for the basic dto. see https://docs.abp.io/en/abp/latest/Best-Practices/Application-Services
public string ConcurrencyStamp { get; set; } public string ConcurrencyStamp { get; set; }
public string CommentUrl { get; set; }
} }

2
modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CreateCommentInput.cs

@ -17,4 +17,6 @@ public class CreateCommentInput
public Guid? CaptchaToken { get; set; } public Guid? CaptchaToken { get; set; }
public int CaptchaAnswer { get; set; } public int CaptchaAnswer { get; set; }
public string CommentUrl { get; set; }
} }

2
modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CreateCommentWithParametersInput.cs

@ -23,4 +23,6 @@ public class CreateCommentWithParametersInput
public Guid? CaptchaToken { get; set; } public Guid? CaptchaToken { get; set; }
public int CaptchaAnswer { get; set; } public int CaptchaAnswer { get; set; }
public string CommentUrl { get; set; }
} }

1
modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs

@ -77,6 +77,7 @@ public class CommentPublicAppService : CmsKitPublicAppServiceBase, ICommentPubli
entityType, entityType,
entityId, entityId,
input.Text, input.Text,
input.CommentUrl,
input.RepliedCommentId input.RepliedCommentId
) )
); );

6
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml

@ -20,8 +20,8 @@
@<span> @<span>
<i class="far fa-comment-alt me-2"></i> <i class="far fa-comment-alt me-2"></i>
@((string.IsNullOrWhiteSpace(author.Name) @((string.IsNullOrWhiteSpace(author.Name)
? author.UserName ? author.UserName
: author.Name + " " + author.Surname).Trim()) : author.Name + " " + author.Surname).Trim())
<small class="text-muted float-end" style="opacity: .5; font-size: 14px">@creationTime.ToString()</small> <small class="text-muted float-end" style="opacity: .5; font-size: 14px">@creationTime.ToString()</small>
</span>; </span>;
} }
@ -157,7 +157,7 @@
} }
@foreach (var comment in Model.Input.Comments) @foreach (var comment in Model.Input.Comments)
{ {
<div class="comment"> <div class="comment" id="answer-@comment.Id.ToString()">
<div class="card p-3 mx-0 my-3"> <div class="card p-3 mx-0 my-3">
<h5> <h5>
@GetCommentTitle(comment.Author, comment.CreationTime).Invoke(null) @GetCommentTitle(comment.Author, comment.CreationTime).Invoke(null)

3
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js

@ -150,6 +150,7 @@
entityType: $commentArea.attr('data-entity-type'), entityType: $commentArea.attr('data-entity-type'),
repliedCommentId: formAsObject.repliedCommentId, repliedCommentId: formAsObject.repliedCommentId,
text: formAsObject.commentText, text: formAsObject.commentText,
commentUrl: window.location.href,
captchaToken: formAsObject.captchaId, captchaToken: formAsObject.captchaId,
captchaAnswer: formAsObject.input?.captcha captchaAnswer: formAsObject.input?.captcha
}), }),
@ -178,7 +179,7 @@
$(location.hash).find('textarea').focus(); $(location.hash).find('textarea').focus();
} }
} }
function init() { function init() {
registerReplyLinks($widget); registerReplyLinks($widget);
registerEditLinks($widget); registerEditLinks($widget);

18
modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs

@ -193,7 +193,8 @@ public class CmsKitDataSeedContributor : IDataSeedContributor, ITransientDepende
_cmsKitTestData.EntityId1, _cmsKitTestData.EntityId1,
"comment", "comment",
null, null,
_cmsKitTestData.User1Id _cmsKitTestData.User1Id,
""
)); ));
await _commentRepository.InsertAsync(new Comment(_guidGenerator.Create(), await _commentRepository.InsertAsync(new Comment(_guidGenerator.Create(),
@ -201,7 +202,8 @@ public class CmsKitDataSeedContributor : IDataSeedContributor, ITransientDepende
_cmsKitTestData.EntityId1, _cmsKitTestData.EntityId1,
"reply", "reply",
comment1.Id, comment1.Id,
_cmsKitTestData.User2Id _cmsKitTestData.User2Id,
""
)); ));
await _commentRepository.InsertAsync(new Comment(_guidGenerator.Create(), await _commentRepository.InsertAsync(new Comment(_guidGenerator.Create(),
@ -209,7 +211,8 @@ public class CmsKitDataSeedContributor : IDataSeedContributor, ITransientDepende
_cmsKitTestData.EntityId1, _cmsKitTestData.EntityId1,
"reply", "reply",
comment1.Id, comment1.Id,
_cmsKitTestData.User1Id _cmsKitTestData.User1Id,
""
)); ));
await _commentRepository.InsertAsync(new Comment(_guidGenerator.Create(), await _commentRepository.InsertAsync(new Comment(_guidGenerator.Create(),
@ -217,7 +220,8 @@ public class CmsKitDataSeedContributor : IDataSeedContributor, ITransientDepende
_cmsKitTestData.EntityId1, _cmsKitTestData.EntityId1,
"comment", "comment",
null, null,
_cmsKitTestData.User2Id _cmsKitTestData.User2Id,
""
)); ));
await _commentRepository.InsertAsync(new Comment(_guidGenerator.Create(), await _commentRepository.InsertAsync(new Comment(_guidGenerator.Create(),
@ -225,7 +229,8 @@ public class CmsKitDataSeedContributor : IDataSeedContributor, ITransientDepende
_cmsKitTestData.EntityId2, _cmsKitTestData.EntityId2,
"comment", "comment",
null, null,
_cmsKitTestData.User2Id _cmsKitTestData.User2Id,
""
)); ));
await _commentRepository.InsertAsync(new Comment(_guidGenerator.Create(), await _commentRepository.InsertAsync(new Comment(_guidGenerator.Create(),
@ -233,7 +238,8 @@ public class CmsKitDataSeedContributor : IDataSeedContributor, ITransientDepende
_cmsKitTestData.EntityId1, _cmsKitTestData.EntityId1,
"comment", "comment",
null, null,
_cmsKitTestData.User2Id _cmsKitTestData.User2Id,
""
)); ));
} }

Loading…
Cancel
Save