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. * Comments published: Load history for publishing date.
**********************************************************************/ **********************************************************************/
$(".last-history-entry").each(function() { $(".last-history-entry").each(function() {
var me = $(this); var lasthistoryentry = $(this);
$.ajax({ $.ajax({
url: me.attr("data-href"), url: lasthistoryentry.attr("data-href"),
success: function (data) { success: function (data) {
let first_history_entry = $(data).find(".historyByLine").first(); lasthistoryentry.html($(data).find(".historyByLine").first());
me.html(first_history_entry);
// format date // format date
registry.scan(me); registry.scan(lasthistoryentry);
}, },
error: function (msg) { error: function (msg) {
alert("Error getting history."); console.error("Error getting history.");
} }
}); });
}); });

View File

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

View File

@ -176,7 +176,7 @@ flaw? Though, the comment is published properly.
>>> browser.raiseHttpErrors = False >>> browser.raiseHttpErrors = False
>>> browser.getControl('Approve', index=0).click() >>> browser.getControl('Approve', index=0).click()
>>> 'Comment approved' in browser.contents >>> 'Comment published' in browser.contents
True True
>>> browser.handleErrors = False >>> browser.handleErrors = False

View File

@ -15,8 +15,15 @@ Add a Comment to a Document and bulk delete it
Given a logged-in Site Administrator Given a logged-in Site Administrator
and workflow multiple enabled and workflow multiple enabled
and a document with discussion enabled and a document with discussion enabled
When I add a comment and delete it When I add a comment and delete it
Then I can not see the comment below the document 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 *** *** Keywords ***
@ -44,6 +51,11 @@ I enable discussion on the document
Select From List name=form.widgets.IAllowDiscussion.allow_discussion:list True Select From List name=form.widgets.IAllowDiscussion.allow_discussion:list True
Click Button Save 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 I add a comment and delete it
Wait until page contains element id=form-widgets-comment-text Wait until page contains element id=form-widgets-comment-text
Input Text id=form-widgets-comment-text This is a comment 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 Go To ${PLONE_URL}/my-document/view
Wait until page contains My Document Wait until page contains My Document
Page should not contain This is a comment 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