diff --git a/plone/app/discussion/browser/configure.zcml b/plone/app/discussion/browser/configure.zcml
index 7bb5aac..c089074 100644
--- a/plone/app/discussion/browser/configure.zcml
+++ b/plone/app/discussion/browser/configure.zcml
@@ -100,6 +100,15 @@
permission="plone.app.discussion.ReviewComments"
/>
+
+
+
tbody > tr");
- if (comments.length === 1) {
+ if (moderate) {
+ // fade out row
+ $(row).fadeOut("normal", function () {
+ $(this).remove();
+ });
+ // reload page if all comments have been removed
+ var comments = $("table#review-comments > tbody > tr");
+ if (comments.length === 1) {
+ location.reload();
+ }
+ } else {
+ location.reload();
+ }
+ },
+ error: function (msg) { // jshint ignore:line
+ alert("Error sending AJAX request:" + target);
+ }
+ });
+ });
+
+
+ /**********************************************************************
+ * Reject a single comment.
+ **********************************************************************/
+ $("input[name='form.button.Reject']").click(function (e) {
+ e.preventDefault();
+ var row = $(this).parent().parent();
+ var path = $(row).find("[name='selected_obj_paths:list']").attr("value");
+ var auth_key = $('input[name="_authenticator"]').val();
+ var target = path + "/@@moderate-reject-comment?_authenticator=" + auth_key;
+ var moderate = $(this).closest("fieldset").attr("id") == "fieldset-moderate-comments";
+ $.ajax({
+ type: "GET",
+ url: target,
+ success: function (msg) { // jshint ignore:line
+ if (moderate) {
+ // fade out row
+ $(row).fadeOut("normal", function () {
+ $(this).remove();
+ });
+ // reload page if all comments have been removed
+ var comments = $("table#review-comments > tbody > tr");
+ if (comments.length === 1) {
+ location.reload();
+ }
+ } else {
location.reload();
}
},
@@ -171,7 +211,8 @@ require([ // jshint ignore:line
**********************************************************************/
$(".last-history-entry").each(function() {
$(this).load($(this).attr("data-href") + " .historyByLine", function() {
- $(this).children(".historyByLine").last().remove();
+ let currententry = $(this).children(".historyByLine").first();
+ $(this).html(currententry);
});
});
diff --git a/plone/app/discussion/browser/moderation.pt b/plone/app/discussion/browser/moderation.pt
index 6f5aea0..e3e56bb 100644
--- a/plone/app/discussion/browser/moderation.pt
+++ b/plone/app/discussion/browser/moderation.pt
@@ -142,7 +142,16 @@
name="form.button.Publish"
i18n:attributes="value label_publish;"
tal:attributes="id item/id"
- tal:condition="python:item.review_state == 'pending'"
+ tal:condition="python:item.review_state in ['pending',]"
+ />
+