moderation view: get last transition entry faster

get it from @@contenthistorypopup instead from @@historyview
This commit is contained in:
Katja Suess 2019-12-16 15:31:48 +01:00
parent 96e0fb83c0
commit f777315da3
4 changed files with 26 additions and 11 deletions

View File

@ -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.");
}
});
});

View File

@ -196,7 +196,7 @@
</td>
<td>
<span class="last-history-entry"
tal:attributes="data-href string:$item_url/@@historyview">
tal:attributes="data-href string:$item_url/@@contenthistorypopup">
last history entry
</span>
</td>

View File

@ -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

View File

@ -18,6 +18,13 @@ Add a Comment to a Document and bulk delete it
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