From dae55074cd75756d1b93806a1daa6549e1114853 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Wed, 31 Oct 2012 22:15:20 +0100 Subject: [PATCH 1/5] really set the modification date --- plone/app/discussion/comment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index 847b99b..2bad1b7 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -220,7 +220,7 @@ def notify_content_object(obj, event): # set the modified date and reindex the item accordingly # so that 304s work correctly. This means that adding a comment # effectively counts as modifying the content type. - content_obj.setModificationDate() + content_obj.setModificationDate(datetime.now()) content_obj.reindexObject(idxs=('total_comments', 'last_comment_date', 'commentators', From d2ccec6efe6e03076513a6763745803e6502910f Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Wed, 31 Oct 2012 22:26:51 +0100 Subject: [PATCH 2/5] Re-apply eleddy's 'Revert modification date since this is fixed in p.a.caching now.' as her commit was lost later on due to some git magic. --- CHANGES.txt | 4 ++++ plone/app/discussion/comment.py | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5177ac7..51ace17 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Changelog 2.2.1 (unreleased) ------------------ +- Re-apply eleddy's "Revert modification date since this is fixed in + p.a.caching now." as her commit was lost later on due to some git magic. + [thet] + - Remove submitting the controlpanel form again after removing disabled tags fixes #13037 and #12357 [maartenkling] diff --git a/plone/app/discussion/comment.py b/plone/app/discussion/comment.py index 2bad1b7..b16101e 100644 --- a/plone/app/discussion/comment.py +++ b/plone/app/discussion/comment.py @@ -217,14 +217,9 @@ def notify_content_object(obj, event): """Tell the content object when a comment is added """ content_obj = aq_parent(aq_parent(obj)) - # set the modified date and reindex the item accordingly - # so that 304s work correctly. This means that adding a comment - # effectively counts as modifying the content type. - content_obj.setModificationDate(datetime.now()) content_obj.reindexObject(idxs=('total_comments', 'last_comment_date', - 'commentators', - )) + 'commentators')) def notify_content_object_deleted(obj, event): From 882236cb150da008ff9fedc91e42e0dd2a6666f6 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Wed, 31 Oct 2012 22:46:10 +0100 Subject: [PATCH 3/5] For migrations of comments without a valid old_status, apply the 'published' state. --- CHANGES.txt | 4 ++++ plone/app/discussion/browser/migration.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 51ace17..69ffb3c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Changelog 2.2.1 (unreleased) ------------------ +- For migrations of comments without a valid old_status, apply the 'published' + state. + [thet] + - Re-apply eleddy's "Revert modification date since this is fixed in p.a.caching now." as her commit was lost later on due to some git magic. [thet] diff --git a/plone/app/discussion/browser/migration.py b/plone/app/discussion/browser/migration.py index 8e478ba..7c55491 100644 --- a/plone/app/discussion/browser/migration.py +++ b/plone/app/discussion/browser/migration.py @@ -121,9 +121,10 @@ class View(BrowserView): 'action': None, 'actor': None, 'comment': 'Migrated workflow state', - 'review_state': old_status.get( + 'review_state': old_status and old_status.get( 'review_state', - new_workflow.initial_state), + new_workflow.initial_state) + or 'published', 'time': DateTime() } workflow.setStatusOf('comment_review_workflow', From 41a53fc8fffc0153518a94844f7a3661c713cf1f Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sun, 4 Nov 2012 17:18:46 +0100 Subject: [PATCH 4/5] Fix failing test. --- plone/app/discussion/tests/functional_test_comments.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plone/app/discussion/tests/functional_test_comments.txt b/plone/app/discussion/tests/functional_test_comments.txt index 7af4dee..14f3e7c 100644 --- a/plone/app/discussion/tests/functional_test_comments.txt +++ b/plone/app/discussion/tests/functional_test_comments.txt @@ -227,7 +227,7 @@ Find a comment id to reply to. >>> browser.open(urldoc1) >>> import re >>> comment_div = re.findall('', browser.contents)[0] - >>> id = re.findall('"([^"]*)"', comment_div)[2] + >>> id = re.findall('"([^"]*)"', comment_div)[1] Post a reply to an existing comment. From e008bcf54dd171dbec46cf9985e9c20773232ab4 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sun, 4 Nov 2012 17:25:25 +0100 Subject: [PATCH 5/5] Whitespace. --- .../browser/javascripts/comments.js | 6 +-- .../browser/javascripts/javascripts.txt | 4 +- .../browser/javascripts/moderation.js | 40 +++++++++---------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/plone/app/discussion/browser/javascripts/comments.js b/plone/app/discussion/browser/javascripts/comments.js index 6519202..9678c6d 100644 --- a/plone/app/discussion/browser/javascripts/comments.js +++ b/plone/app/discussion/browser/javascripts/comments.js @@ -127,16 +127,16 @@ parents(). filter(".comment"). find(".reply-to-comment-button"); - + /* Find the reply-to-comment form and hide and remove it again. */ $.reply_to_comment_form = $(this).parents().filter(".reply"); $.reply_to_comment_form.slideUp("slow", function () { $(this).remove(); }); - + /* Show the reply-to-comment button again. */ reply_to_comment_button.css("display", "inline"); - + }); diff --git a/plone/app/discussion/browser/javascripts/javascripts.txt b/plone/app/discussion/browser/javascripts/javascripts.txt index 59fffb5..99f3056 100644 --- a/plone/app/discussion/browser/javascripts/javascripts.txt +++ b/plone/app/discussion/browser/javascripts/javascripts.txt @@ -17,7 +17,7 @@ content object. Each comment div has a unique id::
- +
@@ -34,7 +34,7 @@ The comment form is rendered inside a "commenting" div::
diff --git a/plone/app/discussion/browser/javascripts/moderation.js b/plone/app/discussion/browser/javascripts/moderation.js index a5cade1..320477d 100644 --- a/plone/app/discussion/browser/javascripts/moderation.js +++ b/plone/app/discussion/browser/javascripts/moderation.js @@ -1,22 +1,22 @@ /****************************************************************************** - * + * * jQuery functions for the plone.app.discussion bulk moderation. - * + * ******************************************************************************/ (function ($) { - // This unnamed function allows us to use $ inside of a block of code + // This unnamed function allows us to use $ inside of a block of code // without permanently overwriting $. // http://docs.jquery.com/Using_jQuery_with_Other_Libraries - + //#JSCOVERAGE_IF 0 - + /************************************************************************** - * Window Load Function: Executes when complete page is fully loaded, + * Window Load Function: Executes when complete page is fully loaded, * including all frames, - **************************************************************************/ + **************************************************************************/ $(window).load(function () { - + /********************************************************************** * Delete a single comment. **********************************************************************/ @@ -47,8 +47,8 @@ } }); }); - - + + /********************************************************************** * Publish a single comment. **********************************************************************/ @@ -78,8 +78,8 @@ } }); }); - - + + /********************************************************************** * Bulk actions for comments (delete, publish) **********************************************************************/ @@ -116,8 +116,8 @@ selectField.find("option[value='-1']").attr('selected', 'selected'); } }); - - + + /********************************************************************** * Check or uncheck all checkboxes from the batch moderation page. **********************************************************************/ @@ -134,12 +134,12 @@ $(this).val("0"); } }); - - + + /********************************************************************** * Show full text of a comment in the batch moderation page. **********************************************************************/ - $(".show-full-comment-text").click(function (e) { + $(".show-full-comment-text").click(function (e) { e.preventDefault(); var target = $(this).attr("href"); var td = $(this).parent(); @@ -156,9 +156,9 @@ } }); }); - + }); - + //#JSCOVERAGE_ENDIF - + }(jQuery));