File: admin_client_config.py

package info (click to toggle)
matrix-synapse 1.146.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,992 kB
  • sloc: python: 261,671; javascript: 7,230; sql: 4,758; sh: 1,302; perl: 626; makefile: 207
file content (25 lines) | stat: -rw-r--r-- 964 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import logging

from synapse.types import JsonMapping

logger = logging.getLogger(__name__)


class AdminClientConfig:
    """Class to track various Synapse-specific admin-only client-impacting config options."""

    def __init__(self, account_data: JsonMapping | None):
        # Allow soft-failed events to be returned down `/sync` and other
        # client APIs. `io.element.synapse.soft_failed: true` is added to the
        # `unsigned` portion of the event to inform clients that the event
        # is soft-failed.
        self.return_soft_failed_events: bool = False
        self.return_policy_server_spammy_events: bool = False

        if account_data:
            self.return_soft_failed_events = account_data.get(
                "return_soft_failed_events", False
            )
            self.return_policy_server_spammy_events = account_data.get(
                "return_policy_server_spammy_events", self.return_soft_failed_events
            )