From a9d0cb574bb0939e61e2a1a4e2cafb92591997c1 Mon Sep 17 00:00:00 2001 From: Ovidiu Miron Date: Tue, 4 Feb 2014 11:00:06 +0200 Subject: [PATCH 1/3] Execute the property workflow --- plone/app/discussion/browser/javascripts/comments.js | 2 +- plone/app/discussion/browser/moderation.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plone/app/discussion/browser/javascripts/comments.js b/plone/app/discussion/browser/javascripts/comments.js index 25accda..85f2e96 100644 --- a/plone/app/discussion/browser/javascripts/comments.js +++ b/plone/app/discussion/browser/javascripts/comments.js @@ -151,7 +151,7 @@ $.ajax({ type: "GET", url: form_url, - data: "workflow_action=publish", + data: data, context: trigger, success: function (msg) { // remove button (trigger object can't be directly removed) diff --git a/plone/app/discussion/browser/moderation.py b/plone/app/discussion/browser/moderation.py index aa7bb91..068cb60 100644 --- a/plone/app/discussion/browser/moderation.py +++ b/plone/app/discussion/browser/moderation.py @@ -131,12 +131,11 @@ class PublishComment(BrowserView): comment = aq_inner(self.context) content_object = aq_parent(aq_parent(comment)) workflowTool = getToolByName(comment, 'portal_workflow', None) - current_state = workflowTool.getInfoFor(comment, 'review_state') - if current_state != 'published': - workflowTool.doActionFor(comment, 'publish') + workflow_action = self.request.form.get('workflow_action', 'publish') + workflowTool.doActionFor(comment, workflow_action) comment.reindexObject() content_object.reindexObject() - IStatusMessage(self.context.REQUEST).addStatusMessage( + StatusMessage(self.context.REQUEST).addStatusMessage( _("Comment approved."), type="info") came_from = self.context.REQUEST.HTTP_REFERER From 6bc5db4276f9eff91e3728eaf322a635dd5cb17a Mon Sep 17 00:00:00 2001 From: Ovidiu Miron Date: Tue, 4 Feb 2014 11:46:29 +0200 Subject: [PATCH 2/3] Fixed typo error --- plone/app/discussion/browser/moderation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plone/app/discussion/browser/moderation.py b/plone/app/discussion/browser/moderation.py index 068cb60..da710b1 100644 --- a/plone/app/discussion/browser/moderation.py +++ b/plone/app/discussion/browser/moderation.py @@ -135,7 +135,7 @@ class PublishComment(BrowserView): workflowTool.doActionFor(comment, workflow_action) comment.reindexObject() content_object.reindexObject() - StatusMessage(self.context.REQUEST).addStatusMessage( + IStatusMessage(self.context.REQUEST).addStatusMessage( _("Comment approved."), type="info") came_from = self.context.REQUEST.HTTP_REFERER From f660a6d9809624660ae2f165fdfdfb8d927b130f Mon Sep 17 00:00:00 2001 From: Ovidiu Miron Date: Tue, 4 Feb 2014 11:53:51 +0200 Subject: [PATCH 3/3] added to CHANGES.rst --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 88650ce..d9fd126 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ Changelog 2.3.0 (unreleased) ------------------ +- Execute the property workflow + [omiron] + - Corrections and additions to the Danish translation [aputtu]