def __init__(self, hs): """ Args: hs (synapse.server.HomeServer): """ # todo: it would be nice to make this more dynamic self._consent_server_notices = ConsentServerNotices(hs)
def __init__(self, hs: "HomeServer"): super().__init__(hs) self._server_notices: Iterable[Union[ ConsentServerNotices, ResourceLimitsServerNotices]] = ( ConsentServerNotices(hs), ResourceLimitsServerNotices(hs), )
def __init__(self, hs): """ Args: hs (synapse.server.HomeServer): """ self._server_notices = (ConsentServerNotices(hs), ResourceLimitsServerNotices(hs))
def __init__(self, hs): """ Args: hs (synapse.server.HomeServer): """ self._server_notices = ( ConsentServerNotices(hs), ResourceLimitsServerNotices(hs), ) # type: Iterable[Union[ConsentServerNotices, ResourceLimitsServerNotices]]
class ServerNoticesSender(object): """A centralised place which sends server notices automatically when Certain Events take place """ def __init__(self, hs): """ Args: hs (synapse.server.HomeServer): """ # todo: it would be nice to make this more dynamic self._consent_server_notices = ConsentServerNotices(hs) def on_user_syncing(self, user_id): """Called when the user performs a sync operation. Args: user_id (str): mxid of user who synced Returns: Deferred """ return self._consent_server_notices.maybe_send_server_notice_to_user( user_id, ) def on_user_ip(self, user_id): """Called on the master when a worker process saw a client request. Args: user_id (str): mxid Returns: Deferred """ # The synchrotrons use a stubbed version of ServerNoticesSender, so # we check for notices to send to the user in on_user_ip as well as # in on_user_syncing return self._consent_server_notices.maybe_send_server_notice_to_user( user_id, )