diff --git a/radicale/sharing/__init__.py b/radicale/sharing/__init__.py index 3a21c53c..db190a11 100644 --- a/radicale/sharing/__init__.py +++ b/radicale/sharing/__init__.py @@ -407,6 +407,42 @@ class BaseSharing: else: logger.trace("sharing/map: not active") + if share is not None: + if share['Conversion'] == "bday": + # autogenerate Actions if not existing + if share['Actions'] is None: + share['Actions'] = { + 'template': { + 'conversion_bday_summary_template': self.conversion_bday_summary_template, + 'conversion_bday_description_template': self.conversion_bday_description_template, + } + } + elif 'template' in share['Actions']: + if 'conversion_bday_summary_template' in share['Actions']['template']: + # nothing to do + pass + else: + share['Actions']['template'].update( + {'conversion_bday_summary_template': self.conversion_bday_summary_template} + ) + if 'conversion_bday_description_template' in share['Actions']['template']: + # nothing to do + pass + else: + share['Actions']['template'].update( + {'conversion_bday_description_template': self.conversion_bday_summary_template} + ) + else: + share['Actions'].update( + {'template': { + 'conversion_bday_summary_template': self.conversion_bday_summary_template, + 'conversion_bday_description_template': self.conversion_bday_description_template, + } + } + ) + + logger.info("sharing/%s: resolved path %r->%r, user %r->%r, Permissions=%r Conversion=%r Actions=%r", share['ShareType'], share['PathOrToken'], share['PathMapped'], user, share['Owner'], share['Permissions'], share['Conversion'], share['Actions']) + return share # adjust a share