Warning message added to discussion control panel that shows up if there are unmigrated comments.

This commit is contained in:
Timo Stollenwerk 2012-03-15 20:00:08 +01:00
parent c76ef0523e
commit 58663fb492
3 changed files with 44 additions and 11 deletions

View File

@ -4,15 +4,18 @@ Changelog
2.1.5 (unreleased)
------------------
- Redirect to "/view" for Image, File and anything listed as requiring
- Redirect to "/view" for Image, File and anything listed as requiring
a view in the url to properly display comments.
[eleddy]
- Make comments and controlpanel views more robust, so they don't break if no
workflow is assigned to the 'Discussion Item' content type.
[timo]
- Warning message added to discussion control panel that shows up if there are
unmigrated comments.
[timo]
2.1.4 (2012-02-29)
------------------
@ -78,15 +81,15 @@ Changelog
- New feature: Markdown syntax added to possible comment text transforms.
[timo]
- Make sure the comment brains are updated properly when the content object is
- Make sure the comment brains are updated properly when the content object is
renamed.
[hannosch, timo]
- Make sure only comments to the content object are removed from the catalog
when the content object is moved.
[hannosch, timo, davisagli]
- Make sure the conversation.getComments method returns acquisition wrapped
- Make sure the conversation.getComments method returns acquisition wrapped
comments.
[timo]
@ -100,7 +103,7 @@ Changelog
2.0.9 (2011-07-25)
------------------
- Make sure the creator index always stores utf-8 encoded stings and not
- Make sure the creator index always stores utf-8 encoded stings and not
unicode.
[timo]
@ -112,7 +115,7 @@ Changelog
fixes http://dev.plone.org/plone/ticket/11298.
[timo]
- Use Plone's safe_encode method instead of encode() for the creator index to
- Use Plone's safe_encode method instead of encode() for the creator index to
make sure unicode encoded strings can be indexed too.
[timo]
@ -120,7 +123,7 @@ Changelog
2.0.7 (2011-07-15)
------------------
- Fix discussion control panel submit for Google Chrome. This fixes
- Fix discussion control panel submit for Google Chrome. This fixes
http://dev.plone.org/plone/ticket/11486.
@ -130,7 +133,7 @@ Changelog
- Update comment brains in zcatalog when moving a content object with comments.
This fixes http://dev.plone.org/plone/ticket/11331.
[timo]
- Plone 3 specific exclusion of plone.app.uuid removed.
[timo]
@ -143,7 +146,7 @@ Changelog
imported after collapsibleformfields.js.
[elro]
- Enable the left-menu on the configlet, to be more consistent with all other
- Enable the left-menu on the configlet, to be more consistent with all other
configlets. Related to http://dev.plone.org/plone/ticket/11737
[WouterVH]
@ -159,7 +162,7 @@ Changelog
- Refactor/clean up the handleComment method.
[timo]
- Make handleComment method store comment attributes from form extenders. This
- Make handleComment method store comment attributes from form extenders. This
allows us to extend the comment form with external add-ons. See
http://packages.python.org/plone.app.discussion/howtos/howto_extend_the_comment_form.html
for details.

View File

@ -61,6 +61,25 @@
</dd>
</dl>
<dl class="portalMessage warning"
tal:condition="view/unmigrated_comments_warning">
<dt i18n:translate="">
Warning
</dt>
<dd i18n:translate="text_unmigrated_comments">
You have comments that have not been migrated to the new
commenting system that has been introduced in Plone 4.1.
Please
<tal:link i18n:name="label_comments_migration_link">
<a href=""
i18n:translate="text_comments_migration_link"
tal:attributes="href string:${portal_url}/@@comment-migration"
>migrate your comments</a>
</tal:link>
to fix this.
</dd>
</dl>
<div metal:use-macro="context/global_statusmessage/macros/portal_message">
Portal status message
</div>

View File

@ -4,6 +4,8 @@ from Acquisition import aq_base, aq_inner
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.interfaces._content import IDiscussionResponse
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.statusmessages.interfaces import IStatusMessage
@ -155,6 +157,15 @@ class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper):
return
return True
def unmigrated_comments_warning(self):
"""Returns true if site contains unmigrated comments.
"""
catalog = getToolByName(aq_inner(self.context), 'portal_catalog', None)
count_comments_old = catalog.searchResults(
object_provides=IDiscussionResponse.__identifier__)
if count_comments_old:
return True
def notify_configuration_changed(event):
"""Event subscriber that is called every time the configuration changed.