From f777315da3af6693ae0336da9a49b3bd00b983a9 Mon Sep 17 00:00:00 2001 From: Katja Suess Date: Mon, 16 Dec 2019 15:31:48 +0100 Subject: [PATCH] moderation view: get last transition entry faster get it from @@contenthistorypopup instead from @@historyview --- .../browser/javascripts/moderation.js | 12 +++++------ plone/app/discussion/browser/moderation.pt | 2 +- ...unctional_test_comment_review_workflow.txt | 2 +- .../tests/robot/test_moderation.robot | 21 +++++++++++++++++-- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/plone/app/discussion/browser/javascripts/moderation.js b/plone/app/discussion/browser/javascripts/moderation.js index 1450af3..1016fda 100644 --- a/plone/app/discussion/browser/javascripts/moderation.js +++ b/plone/app/discussion/browser/javascripts/moderation.js @@ -224,18 +224,16 @@ require(["jquery", "pat-registry"], function($, registry) { * Comments published: Load history for publishing date. **********************************************************************/ $(".last-history-entry").each(function() { - var me = $(this); + var lasthistoryentry = $(this); $.ajax({ - url: me.attr("data-href"), + url: lasthistoryentry.attr("data-href"), success: function (data) { - let first_history_entry = $(data).find(".historyByLine").first(); - me.html(first_history_entry); - + lasthistoryentry.html($(data).find(".historyByLine").first()); // format date - registry.scan(me); + registry.scan(lasthistoryentry); }, error: function (msg) { - alert("Error getting history."); + console.error("Error getting history."); } }); }); diff --git a/plone/app/discussion/browser/moderation.pt b/plone/app/discussion/browser/moderation.pt index 676c55b..df6d455 100644 --- a/plone/app/discussion/browser/moderation.pt +++ b/plone/app/discussion/browser/moderation.pt @@ -196,7 +196,7 @@ + tal:attributes="data-href string:$item_url/@@contenthistorypopup"> last history entry diff --git a/plone/app/discussion/tests/functional_test_comment_review_workflow.txt b/plone/app/discussion/tests/functional_test_comment_review_workflow.txt index 5531888..84d384f 100644 --- a/plone/app/discussion/tests/functional_test_comment_review_workflow.txt +++ b/plone/app/discussion/tests/functional_test_comment_review_workflow.txt @@ -176,7 +176,7 @@ flaw? Though, the comment is published properly. >>> browser.raiseHttpErrors = False >>> browser.getControl('Approve', index=0).click() - >>> 'Comment approved' in browser.contents + >>> 'Comment published' in browser.contents True >>> browser.handleErrors = False diff --git a/plone/app/discussion/tests/robot/test_moderation.robot b/plone/app/discussion/tests/robot/test_moderation.robot index cbdffdb..bca8562 100644 --- a/plone/app/discussion/tests/robot/test_moderation.robot +++ b/plone/app/discussion/tests/robot/test_moderation.robot @@ -15,8 +15,15 @@ Add a Comment to a Document and bulk delete it Given a logged-in Site Administrator and workflow multiple enabled and a document with discussion enabled - When I add a comment and delete it - Then I can not see the comment below the document + When I add a comment and delete it + Then I can not see the comment below the document + +Last history entry is shown + Given a logged-in Site Administrator + and workflow multiple enabled + and a document with discussion enabled + When I add a comment + Then I can see the last history entry in moderation view *** Keywords *** @@ -44,6 +51,11 @@ I enable discussion on the document Select From List name=form.widgets.IAllowDiscussion.allow_discussion:list True Click Button Save +I add a comment + Wait until page contains element id=form-widgets-comment-text + Input Text id=form-widgets-comment-text This is a comment + Click Button Comment + I add a comment and delete it Wait until page contains element id=form-widgets-comment-text Input Text id=form-widgets-comment-text This is a comment @@ -65,3 +77,8 @@ I can not see the comment below the document Go To ${PLONE_URL}/my-document/view Wait until page contains My Document Page should not contain This is a comment + +I can see the last history entry in moderation view + Go To ${PLONE_URL}/@@moderate-comments?review_state=all + Wait until page contains element name=form.select.BulkAction + Page should contain Create