Skip to content

Commit 38ec723

Browse files
committed
Update javascript to remove the unneeded parameter.
1 parent 648949e commit 38ec723

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

source/DasBlog.Web.UI/TagHelpers/Comments/CommentApprovalLinkTagHelper.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public class CommentApprovalLinkTagHelper : TagHelper
1313

1414
private readonly IDasBlogSettings dasBlogSettings;
1515

16-
private const string COMMENTAPPROVE_URL = "{0}/comments/{1}";
1716
private const string COMMENTTEXT_MSG = "Are you sure you want to approve the comment from '{0}'?";
1817

1918
public CommentApprovalLinkTagHelper(IDasBlogSettings dasBlogSettings)
@@ -25,16 +24,10 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
2524
{
2625
var commenttxt = string.Format(COMMENTTEXT_MSG, Comment.Name);
2726
var message = "Comment Approved";
28-
var admin = string.Empty;
29-
30-
if (Admin)
31-
{
32-
admin = "ADMIN";
33-
}
3427

3528
output.TagName = "a";
3629
output.TagMode = TagMode.StartTagAndEndTag;
37-
output.Attributes.SetAttribute("href", $"javascript:commentManagement(\"{Comment.BlogPostId}\",\"{Comment.CommentId}\",\"{commenttxt}\",\"PATCH\",\"{admin}\")");
30+
output.Attributes.SetAttribute("href", $"javascript:commentManagement(\"{Comment.BlogPostId}\",\"{Comment.CommentId}\",\"{commenttxt}\",\"PATCH\")");
3831
output.Attributes.SetAttribute("class", "dbc-comment-approve-link");
3932

4033
var content = await output.GetChildContentAsync();

source/DasBlog.Web.UI/TagHelpers/Comments/CommentDeleteLinkTagHelper.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public class CommentDeleteLinkTagHelper : TagHelper
1515
public bool Admin { get; set; } = false;
1616

1717
private readonly IDasBlogSettings dasBlogSettings;
18-
private const string COMMENTDELETE_URL = "{0}/comments/{1}";
1918
private const string COMMENTTEXT_MSG = "Are you sure you want to delete the comment from '{0}'?";
2019

2120
public CommentDeleteLinkTagHelper(IDasBlogSettings dasBlogSettings)
@@ -26,17 +25,11 @@ public CommentDeleteLinkTagHelper(IDasBlogSettings dasBlogSettings)
2625
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
2726
{
2827
var commenttxt = string.Format(COMMENTTEXT_MSG, Comment.Name);
29-
var admin = string.Empty;
3028
var message = "Delete Comment";
3129

32-
if (Admin)
33-
{
34-
admin = "ADMIN";
35-
}
36-
3730
output.TagName = "a";
3831
output.TagMode = TagMode.StartTagAndEndTag;
39-
output.Attributes.SetAttribute("href", $"javascript:commentManagement(\"{Comment.BlogPostId}\",\"{Comment.CommentId}\",\"{commenttxt}\",\"DELETE\",\"{admin}\")");
32+
output.Attributes.SetAttribute("href", $"javascript:commentManagement(\"{Comment.BlogPostId}\",\"{Comment.CommentId}\",\"{commenttxt}\",\"DELETE\")");
4033
output.Attributes.SetAttribute("class", "dbc-comment-delete-link");
4134

4235
var content = await output.GetChildContentAsync();

source/DasBlog.Web.UI/wwwroot/js/site.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11

2-
function commentManagement(postid, commentid, commentText, httpVerb, adminhref) {
2+
function commentManagement(postid, commentid, commentText, httpVerb) {
33
if (confirm(commentText)) {
44
var oReq = new XMLHttpRequest();
55

66
url = 'post/' + postid + '/comments/' + commentid;
77

88
oReq.onreadystatechange = function () {
99
if (this.readyState == 4 && this.status == 200) {
10-
11-
if (adminhref.length != 0) {
12-
url = 'admin/manage-comments/' + postid;
13-
}
14-
location.href = url;
15-
10+
location.href = window.location.href;
1611
}
1712
};
1813

0 commit comments

Comments
 (0)