Skip to content

Commit

Permalink
Keep annexes when migrating Meetings to DX
Browse files Browse the repository at this point in the history
Fixed display of empty textearea on meeting_view
See #MPMPHAI-76
  • Loading branch information
gbastien committed Feb 9, 2021
1 parent 63fb67b commit 4691ae8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/Products/PloneMeeting/Meeting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2151,6 +2151,8 @@ def numberOfItems(self):
def manage_beforeDelete(self, item, container):
'''This is a workaround to avoid a Plone design problem where it is
possible to remove a folder containing objects you can not remove.'''
# bypassed for migration to DX
return
# If we are here, everything has already been checked before.
# Just check that the meeting is myself or a Plone Site.
# We can remove an meeting directly but not "through" his container.
Expand Down
3 changes: 2 additions & 1 deletion src/Products/PloneMeeting/MeetingItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,8 @@ def Title(self, withMeetingDate=False, **kwargs):
title = self.getField('title').get(self, **kwargs)
if withMeetingDate:
meeting = self.getMeeting()
if meeting:
# XXX check on datetime to be removed after Meeting migration to DX
if meeting and isinstance(meeting.date, datetime):
tool = api.portal.get_tool('portal_plonemeeting')
return "{0} ({1})".format(
title, tool.format_date(meeting.date, with_hour=True).encode('utf-8'))
Expand Down
4 changes: 3 additions & 1 deletion src/Products/PloneMeeting/content/meeting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,9 @@ def update_local_roles(self, **kwargs):
updateAnnexesAccess(self)
# reindex object security except if avoid_reindex=True and localroles are the same
avoid_reindex = kwargs.get('avoid_reindex', False)
if not avoid_reindex or old_local_roles != self.__ac_local_roles__:
# XXX check on currently_migrating_meeting_dx to be removed after Meeting migrated to DX
if not self.REQUEST.get('currently_migrating_meeting_dx') and \
(not avoid_reindex or old_local_roles != self.__ac_local_roles__):
self.reindexObjectSecurity()

def _update_power_observers_local_roles(self):
Expand Down
6 changes: 3 additions & 3 deletions src/Products/PloneMeeting/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ def meeting_uid(obj):
# we use same 'None' value as for getPreferredMeeting so we may use the same
# vocabulary in the meeting date/preferred meeting date faceted filters
res = ITEM_NO_PREFERRED_MEETING_VALUE
meeting = obj.getMeeting()
if meeting:
res = meeting.UID()
meeting_uid = obj.getMeeting(only_uid=True)
if meeting_uid:
res = meeting_uid
return res


Expand Down
9 changes: 6 additions & 3 deletions src/Products/PloneMeeting/migrations/migrate_to_4200.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from imio.helpers.content import safe_delattr
from imio.pyutils.utils import replace_in_list
from persistent.mapping import PersistentMapping
from plone.app.contenttypes.migration.dxmigration import ContentMigrator
from plone.app.contenttypes.migration.migration import migrate as pac_migrate
from plone.app.textfield.value import RichTextValue
from Products.contentmigration.basemigrator.migrator import CMFFolderMigrator
from Products.CMFPlone.utils import base_hasattr
from Products.GenericSetup.tool import DEPENDENCY_STRATEGY_NEW
from Products.PloneMeeting.browser.itemattendee import position_type_default
Expand All @@ -28,7 +28,7 @@
from zope.interface import noLongerProvides


class MeetingMigrator(ContentMigrator):
class MeetingMigrator(CMFFolderMigrator):
""" """
src_portal_type = None
src_meta_type = 'Meeting'
Expand Down Expand Up @@ -135,6 +135,7 @@ def _migrateMeetingToDX(self):
self._configureVotes()

# main migrate meetings to DX
self.request.set('currently_migrating_meeting_dx', True)
for cfg in self.tool.objectValues("MeetingConfig"):
# update MeetingConfig attributes
# usedMeetingAttributes
Expand Down Expand Up @@ -203,6 +204,8 @@ def _migrateMeetingToDX(self):
safe_delattr(cfg, "freezeDeadlineDefault")
safe_delattr(cfg, "preMeetingDateDefault")

self.request.set('currently_migrating_meeting_dx', False)

# after migration to DX
# fix DashboardCollections that use renamed indexes
self.changeCollectionIndex('getDate', 'meeting_date')
Expand Down Expand Up @@ -540,7 +543,7 @@ def run(self, extra_omitted=[]):
# update holidays
self.updateHolidays()

self.tool.update_all_local_roles(meta_type=('MeetingItem', ))
self.tool.update_all_local_roles()
self.refreshDatabase(workflows=True, catalogsToUpdate=[])


Expand Down

0 comments on commit 4691ae8

Please sign in to comment.