mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 19:44:02 +08:00
Fixing comments regressions
Work Items: 19333 17962 --HG-- branch : 1.x
This commit is contained in:
@@ -104,6 +104,12 @@ namespace Orchard.Comments.Drivers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if editing from the admin, don't update the owner or the status
|
||||||
|
if (!string.IsNullOrEmpty(name) && String.Equals(name, "save", StringComparison.OrdinalIgnoreCase)) {
|
||||||
|
_orchardServices.Notifier.Information(T("Comment saved."));
|
||||||
|
return Editor(part, shapeHelper);
|
||||||
|
}
|
||||||
|
|
||||||
part.CommentDateUtc = _clock.UtcNow;
|
part.CommentDateUtc = _clock.UtcNow;
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(part.SiteName) && !part.SiteName.StartsWith("http://") && !part.SiteName.StartsWith("https://")) {
|
if (!String.IsNullOrEmpty(part.SiteName) && !part.SiteName.StartsWith("http://") && !part.SiteName.StartsWith("https://")) {
|
||||||
@@ -121,10 +127,19 @@ namespace Orchard.Comments.Drivers {
|
|||||||
part.Status = moderateComments ? CommentStatus.Pending : CommentStatus.Approved;
|
part.Status = moderateComments ? CommentStatus.Pending : CommentStatus.Approved;
|
||||||
|
|
||||||
var commentedOn = _contentManager.Get<ICommonPart>(part.CommentedOn);
|
var commentedOn = _contentManager.Get<ICommonPart>(part.CommentedOn);
|
||||||
|
|
||||||
|
// prevent users from commenting on a closed thread by hijacking the commentedOn property
|
||||||
|
var commentsPart = commentedOn.As<CommentsPart>();
|
||||||
|
if (!commentsPart.CommentsActive) {
|
||||||
|
_orchardServices.TransactionManager.Cancel();
|
||||||
|
return Editor(part, shapeHelper);
|
||||||
|
}
|
||||||
|
|
||||||
if (commentedOn != null && commentedOn.Container != null) {
|
if (commentedOn != null && commentedOn.Container != null) {
|
||||||
part.CommentedOnContainer = commentedOn.Container.ContentItem.Id;
|
part.CommentedOnContainer = commentedOn.Container.ContentItem.Id;
|
||||||
}
|
}
|
||||||
commentedOn.As<CommentsPart>().Record.CommentPartRecords.Add(part.Record);
|
|
||||||
|
commentsPart.Record.CommentPartRecords.Add(part.Record);
|
||||||
|
|
||||||
return Editor(part, shapeHelper);
|
return Editor(part, shapeHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<button class="primaryAction" type="submit" name="submit.Save" >@T("Save")</button>
|
<button class="primaryAction" type="submit" name="submit.Save" value="save" >@T("Save")</button>
|
||||||
<button class="primaryAction" type="submit" name="submit.Save" value="delete" itemprop="RemoveUrl">@T("Delete")</button>
|
<button class="primaryAction" type="submit" name="submit.Save" value="delete" itemprop="RemoveUrl">@T("Delete")</button>
|
||||||
@if (Model.Status == CommentStatus.Approved) {
|
@if (Model.Status == CommentStatus.Approved) {
|
||||||
<button class="primaryAction" type="submit" name="submit.Save" value="moderate">@T("Moderate")</button>
|
<button class="primaryAction" type="submit" name="submit.Save" value="moderate">@T("Moderate")</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user