您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

52 行
2.0 KiB

  1. # Copyright 2015, 2016 OpenMarket Ltd
  2. # Copyright 2017 New Vector Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. from typing import Any
  16. from synapse.types import JsonDict
  17. from ._base import Config
  18. class PushConfig(Config):
  19. section = "push"
  20. def read_config(self, config: JsonDict, **kwargs: Any) -> None:
  21. push_config = config.get("push") or {}
  22. self.push_include_content = push_config.get("include_content", True)
  23. self.push_group_unread_count_by_room = push_config.get(
  24. "group_unread_count_by_room", True
  25. )
  26. # There was a a 'redact_content' setting but mistakenly read from the
  27. # 'email'section'. Check for the flag in the 'push' section, and log,
  28. # but do not honour it to avoid nasty surprises when people upgrade.
  29. if push_config.get("redact_content") is not None:
  30. print(
  31. "The push.redact_content content option has never worked. "
  32. "Please set push.include_content if you want this behaviour"
  33. )
  34. # Now check for the one in the 'email' section and honour it,
  35. # with a warning.
  36. push_config = config.get("email") or {}
  37. redact_content = push_config.get("redact_content")
  38. if redact_content is not None:
  39. print(
  40. "The 'email.redact_content' option is deprecated: "
  41. "please set push.include_content instead"
  42. )
  43. self.push_include_content = not redact_content