Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

Bump mixin-deep from 1.3.1 to 1.3.2 in /host/EasyAbp.EasyComment.IdentityServer #2

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions EasyAbp.EasyComment.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Overrides/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Async/@EntryIndexedValue">False</s:String>
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Mutable/@EntryIndexedValue">False</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EC/@EntryIndexedValue">EC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String>
</wpf:ResourceDictionary>
6 changes: 3 additions & 3 deletions host/EasyAbp.EasyComment.IdentityServer/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1637,9 +1637,9 @@ minizlib@^1.2.1:
minipass "^2.2.1"

mixin-deep@^1.2.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe"
integrity sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==
version "1.3.2"
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"
integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==
dependencies:
for-in "^1.0.2"
is-extendable "^1.0.1"
Expand Down
14 changes: 8 additions & 6 deletions host/EasyAbp.EasyComment.Web.Unified/Pages/Comments.cshtml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
@page
@model EasyAbp.EasyComment.Pages.Comments

<h3>Comments</h3>
@await Component.InvokeAsync("CommentWidget", new
{
ItemType = "TestItemType",
ItemKey = "TestItemKey"
})
<div style="width: 600px;">
<h3>Comments</h3>
@await Component.InvokeAsync("CommentsWidget", new
{
ItemType = "TestItemType",
ItemKey = "TestItemKey"
})
</div>


Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public interface ICommentAppService :
CreateUpdateCommentDto,
CreateUpdateCommentDto>
{
Task<CommentDto> AddCommentAsync(CreateUpdateCommentDto input);
Task<CommentDto> UpdateContentAsync(UpdateContentInput input);
Task DeleteCommentAsync(Guid id);
Task RemoveCommentAsync(Guid id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ protected override CommentDto MapToGetListOutputDto(Comment entity)
return dto;
}

[Authorize]
public virtual async Task<CommentDto> AddCommentAsync(CreateUpdateCommentDto input)
{
var entity = MapToEntity(input);

TryToSetTenantId(entity);

await Repository.InsertAsync(entity, autoSave: true);

return MapToGetOutputDto(entity);
}

[Authorize]
public virtual async Task<CommentDto> UpdateContentAsync(UpdateContentInput input)
{
Expand All @@ -69,7 +81,7 @@ public virtual async Task<CommentDto> UpdateContentAsync(UpdateContentInput inpu
}

[Authorize]
public virtual async Task DeleteCommentAsync(Guid id)
public virtual async Task RemoveCommentAsync(Guid id)
{
var comment = await GetEntityByIdAsync(id);
if (comment.CreatorId != CurrentUser.GetId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@
"Comment": "Comment",
"CommentItemType": "Item Type",
"CommentItemKey": "Item Key",
"CommentContent": "Content",
"CommentContent": "Comment Content",
"CommentReplyTo": "Reply To",
"CreateComment": "Create Comment",
"EditComment": "Edit Comment",
"CommentDeletionConfirmationMessage": "Are you sure to delete the comment {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"EasyComment:001" : "Users are only allowed to edit their own comments",
"EasyComment:002" : "Users are only allowed to delete their own comments",
"TotalComments" : "{0} comments"
"TotalComments" : "{0} comments",
"PublishComment": "Publish",
"LeaveComment": "Leave Comment",
"NeedCommentContent": "Please enter the content",
"SuccessfullyPublishComment": "Comment published successfully",
"Remove": "Delete",
"Reference": "Reference",
"Reply": "Reply",
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
"Comment": "评论",
"CommentItemType": "项目类型",
"CommentItemKey": "项目键值",
"CommentContent": "内容",
"CommentContent": "评论内容",
"CommentReplyTo": "回复给",
"CreateComment": "创建评论",
"EditComment": "编辑评论",
"CommentDeletionConfirmationMessage": "确定删除评论 {0}?",
"SuccessfullyDeleted": "删除成功",
"EasyComment:001" : "用户只能更新自己的评论",
"EasyComment:002" : "用户只能删除自己的评论",
"TotalComments" : "共 {0} 条评论"
"TotalComments" : "共 {0} 条评论",
"PublishComment": "发表",
"LeaveComment": "发表评论",
"NeedCommentContent": "请输入评论内容",
"SuccessfullyPublishComment": "发表评论成功",
"Remove": "删除",
"Reference": "引用",
"Reply": "回复"
}
}
13 changes: 10 additions & 3 deletions src/EasyAbp.EasyComment.HttpApi/Comments/CommentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace EasyAbp.EasyComment.Comments
{
[RemoteService(Name = "CommentService")]
[Route("/api/EasyComment/comment")]
[Route("/api/easyComment/comment")]
public class CommentController : EasyCommentController, ICommentAppService
{
private readonly ICommentAppService _service;
Expand Down Expand Up @@ -51,6 +51,13 @@ public Task DeleteAsync(Guid id)
return _service.DeleteAsync(id);
}

[HttpPost]
[Route("comment")]
public Task<CommentDto> AddCommentAsync(CreateUpdateCommentDto input)
{
return _service.AddCommentAsync(input);
}

[HttpPut]
[Route("content")]
public Task<CommentDto> UpdateContentAsync(UpdateContentInput input)
Expand All @@ -60,9 +67,9 @@ public Task<CommentDto> UpdateContentAsync(UpdateContentInput input)

[HttpDelete]
[Route("{id}/comment")]
public Task DeleteCommentAsync(Guid id)
public Task RemoveCommentAsync(Guid id)
{
return _service.DeleteCommentAsync(id);
return _service.RemoveCommentAsync(id);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,4 @@
<ProjectReference Include="..\EasyAbp.EasyComment.Application.Contracts\EasyAbp.EasyComment.Application.Contracts.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Comments" />
</ItemGroup>

</Project>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form;

namespace EasyAbp.EasyComment.Web.Pages.Shared.Components.CommentEditorWidget
{
public class CommentEditorViewModel
{
public bool ShowLabel { get; set; }

[Required(ErrorMessage = "NeedCommentContent")]
[TextArea]
[Display(Name = "CommentContent")]
public string Content { get; set; }

public bool EditModel { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Microsoft.AspNetCore.Mvc;

namespace EasyAbp.EasyComment.Web.Pages.Shared.Components.CommentEditorWidget
{
[Route("/widgets/easyComment")]
public class CommentEditorWidgetController : EasyCommentController
{
[HttpGet]
[Route("showCommentEditor")]
public IActionResult ShowCommentEditor(Guid? id, bool showLabel, bool editModel)
{
return ViewComponent("CommentEditorWidget", new {id, showLabel, editModel});
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EasyComment.Comments;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;

namespace EasyAbp.EasyComment.Web.Pages.Shared.Components.CommentEditorWidget
{
[Widget(
RefreshUrl = "/widgets/easyComment/showCommentEditor"
)]
public class CommentEditorWidgetViewComponent : AbpViewComponent
{
private readonly ICommentAppService _service;

public CommentEditorWidgetViewComponent(ICommentAppService service)
{
_service = service;
}

public async Task<IViewComponentResult> InvokeAsync(Guid? id, bool showLabel, bool editModel)
{
var viewModel = new CommentEditorViewModel
{
ShowLabel = showLabel,
EditModel = editModel,
};
if (id.HasValue)
{
var comment = await _service.GetAsync(id.Value);
viewModel.Content = comment.Content;
}
return View(viewModel);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@using EasyAbp.EasyComment.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@model EasyAbp.EasyComment.Web.Pages.Shared.Components.CommentEditorWidget.CommentEditorViewModel
@inject IHtmlLocalizer<EasyCommentResource> L

<form>
@if (Model.ShowLabel)
{
<label class="ec-leave-comment" asp-for="Content">@L["LeaveComment"]</label>
}
<abp-input class="ec-textarea-new-comment" asp-for="Content" rows="5" no-label></abp-input>
@if (Model.EditModel)
{
<div class="ec-button-group-edit">
<abp-button class="ec-button-cancel" type="button" button-type="Secondary" text="@L["Cancel"].Value"/>
<abp-button class="ec-button-edit" type="submit" button-type="Primary" text="@L["Save"].Value"/>
</div>
}
else
{
<abp-button class="ec-button-publish" type="submit" button-type="Info" text="@L["PublishComment"].Value"/>
}
</form>
<div style="clear: both;"></div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

namespace EasyAbp.EasyComment.Web.Pages.Shared.Components.CommentViewerWidget
{
public class CommentViewerViewModel
{
public Guid Id { get; set; }
public string Content { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Microsoft.AspNetCore.Mvc;

namespace EasyAbp.EasyComment.Web.Pages.Shared.Components.CommentViewerWidget
{
[Route("/widgets/easyComment")]
public class CommentViewerWidgetController : EasyCommentController
{
[HttpGet]
[Route("showCommentViewer")]
public IActionResult ShowCommentViewer(Guid id, string content, bool fromServer)
{
return ViewComponent("CommentViewerWidget", new {id, content, fromServer});
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EasyComment.Comments;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;

namespace EasyAbp.EasyComment.Web.Pages.Shared.Components.CommentViewerWidget
{
[Widget(
RefreshUrl = "/widgets/easyComment/showCommentViewer"
)]
public class CommentViewerWidgetViewComponent : AbpViewComponent
{
private readonly ICommentAppService _service;

public CommentViewerWidgetViewComponent(ICommentAppService service)
{
_service = service;
}

public async Task<IViewComponentResult> InvokeAsync(Guid id, string content, bool fromServer)
{
if (fromServer)
{
var comment = await _service.GetAsync(id);
content = comment.Content;
}
return View(new CommentViewerViewModel
{
Id = id,
Content = content,
});
}
}
}
Loading