示例#1
0
    def actives_shares(self) -> int:
        # TODO - G.M - 2019-08-12 - handle case where share app is not enabled, by
        # not starting it there. see #2189
        from tracim_backend.applications.share.lib import ShareLib

        api = ShareLib(config=self.config, session=self.dbsession, current_user=self._user)
        return len(api.get_content_shares(self.content))
示例#2
0
 def get_content_shares(
         self,
         context,
         request: TracimRequest,
         hapic_data=None) -> typing.List[ContentShareInContext]:
     """
     Get all share related to a file
     """
     app_config = request.registry.settings["CFG"]  # type: CFG
     api = ShareLib(
         current_user=request.current_user,
         session=request.dbsession,
         config=app_config,
         show_disabled=hapic_data.query.show_disabled,
     )
     shares_content = api.get_content_shares(request.current_content)
     return api.get_content_shares_in_context(shares_content)