From b9573ee1ac33afb8f90103b89b9d32abdc840bc0 Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Thu, 2 Jun 2011 16:17:13 +0300
Subject: [PATCH] Discussion Post should behave as embedded document by default
 (i.e. acquire security from parent).

---
 .../PortalTypeTemplateItem/portal_types/Discussion%20Post.xml | 2 +-
 .../workflow_chain_type.xml                                   | 2 +-
 .../DiscussionThread_createNewDiscussionPost.xml              | 1 -
 .../erp5_discussion/DiscussionThread_viewAsWeb.xml            | 2 +-
 .../erp5_discussion/WebSection_createNewDiscussionThread.xml  | 1 -
 bt5/erp5_discussion/bt/revision                               | 2 +-
 .../bt/template_portal_type_workflow_chain_list               | 4 +---
 7 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/bt5/erp5_discussion/PortalTypeTemplateItem/portal_types/Discussion%20Post.xml b/bt5/erp5_discussion/PortalTypeTemplateItem/portal_types/Discussion%20Post.xml
index e394136cb9..8ed57f43bb 100644
--- a/bt5/erp5_discussion/PortalTypeTemplateItem/portal_types/Discussion%20Post.xml
+++ b/bt5/erp5_discussion/PortalTypeTemplateItem/portal_types/Discussion%20Post.xml
@@ -27,7 +27,7 @@
         </item>
         <item>
             <key> <string>acquire_local_roles</string> </key>
-            <value> <int>0</int> </value>
+            <value> <int>1</int> </value>
         </item>
         <item>
             <key> <string>content_icon</string> </key>
diff --git a/bt5/erp5_discussion/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml b/bt5/erp5_discussion/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
index 8c67622035..1bb4bec0fd 100644
--- a/bt5/erp5_discussion/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
+++ b/bt5/erp5_discussion/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
@@ -1,7 +1,7 @@
 <workflow_chain>
  <chain>
   <type>Discussion Post</type>
-  <workflow>document_conversion_interaction_workflow, document_publication_workflow, document_security_interaction_workflow, edit_workflow</workflow>
+  <workflow>edit_workflow, embeddedt_workflow</workflow>
  </chain>
  <chain>
   <type>Discussion Thread</type>
diff --git a/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/DiscussionThread_createNewDiscussionPost.xml b/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/DiscussionThread_createNewDiscussionPost.xml
index 7ed03239fb..8f3b918c87 100644
--- a/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/DiscussionThread_createNewDiscussionPost.xml
+++ b/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/DiscussionThread_createNewDiscussionPost.xml
@@ -71,7 +71,6 @@ discussion_post = context.newContent(\n
 \n
 # depending on security model Post can be submited for review\n
 portal_status_message = "New post created in background."\n
-discussion_post.release()\n
 \n
 return context.Base_redirect(form_id,\n
          keep_items = dict(portal_status_message=context.Base_translateString(portal_status_message)))\n
diff --git a/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/DiscussionThread_viewAsWeb.xml b/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/DiscussionThread_viewAsWeb.xml
index df828e7efa..4e75b55af7 100644
--- a/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/DiscussionThread_viewAsWeb.xml
+++ b/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/DiscussionThread_viewAsWeb.xml
@@ -76,7 +76,6 @@
                     <value>
                       <list>
                         <string>listbox</string>
-                        <string>my_rss_link</string>
                       </list>
                     </value>
                 </item>
@@ -100,6 +99,7 @@
                       <list>
                         <string>my_title</string>
                         <string>my_include</string>
+                        <string>my_rss_link</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_createNewDiscussionThread.xml b/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_createNewDiscussionThread.xml
index 7948b5fc87..0b538e53b8 100644
--- a/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_createNewDiscussionThread.xml
+++ b/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_createNewDiscussionThread.xml
@@ -97,7 +97,6 @@ discussion_post = discussion_thread.newContent(\n
 # depending on security model Thread and Post can be directly published or shared\n
 portal_status_message = "New discussion created. Your post will be reviewed for approval."\n
 discussion_thread.submit()\n
-discussion_post.submit()\n
 \n
 if send_notification_text not in (\'\', None):\n
   # we can send notifications\n
diff --git a/bt5/erp5_discussion/bt/revision b/bt5/erp5_discussion/bt/revision
index d97edbb29f..105d7d9ad3 100644
--- a/bt5/erp5_discussion/bt/revision
+++ b/bt5/erp5_discussion/bt/revision
@@ -1 +1 @@
-99
\ No newline at end of file
+100
\ No newline at end of file
diff --git a/bt5/erp5_discussion/bt/template_portal_type_workflow_chain_list b/bt5/erp5_discussion/bt/template_portal_type_workflow_chain_list
index 76057bf61a..3904ea9e9e 100644
--- a/bt5/erp5_discussion/bt/template_portal_type_workflow_chain_list
+++ b/bt5/erp5_discussion/bt/template_portal_type_workflow_chain_list
@@ -1,7 +1,5 @@
-Discussion Post | document_conversion_interaction_workflow
-Discussion Post | document_publication_workflow
-Discussion Post | document_security_interaction_workflow
 Discussion Post | edit_workflow
+Discussion Post | embeddedt_workflow
 Discussion Thread | document_conversion_interaction_workflow
 Discussion Thread | document_publication_workflow
 Discussion Thread | document_security_interaction_workflow
-- 
2.30.9