Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 2b110dd

Browse files
Fix the formatting of push config section (#8818)
This PR updates the push config's formatting to better align with our [code style guidelines](https://github.com/matrix-org/synapse/blob/develop/docs/code_style.md#configuration-file-format).
1 parent d963c69 commit 2b110dd

File tree

3 files changed

+40
-29
lines changed

3 files changed

+40
-29
lines changed

changelog.d/8818.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update the formatting of the `push` section of the homeserver config file to better align with the [code style guidelines](https://github.com/matrix-org/synapse/blob/develop/docs/code_style.md#configuration-file-format).

docs/sample_config.yaml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2251,20 +2251,25 @@ password_providers:
22512251

22522252

22532253

2254-
# Clients requesting push notifications can either have the body of
2255-
# the message sent in the notification poke along with other details
2256-
# like the sender, or just the event ID and room ID (`event_id_only`).
2257-
# If clients choose the former, this option controls whether the
2258-
# notification request includes the content of the event (other details
2259-
# like the sender are still included). For `event_id_only` push, it
2260-
# has no effect.
2261-
#
2262-
# For modern android devices the notification content will still appear
2263-
# because it is loaded by the app. iPhone, however will send a
2264-
# notification saying only that a message arrived and who it came from.
2265-
#
2266-
#push:
2267-
# include_content: true
2254+
## Push ##
2255+
2256+
push:
2257+
# Clients requesting push notifications can either have the body of
2258+
# the message sent in the notification poke along with other details
2259+
# like the sender, or just the event ID and room ID (`event_id_only`).
2260+
# If clients choose the former, this option controls whether the
2261+
# notification request includes the content of the event (other details
2262+
# like the sender are still included). For `event_id_only` push, it
2263+
# has no effect.
2264+
#
2265+
# For modern android devices the notification content will still appear
2266+
# because it is loaded by the app. iPhone, however will send a
2267+
# notification saying only that a message arrived and who it came from.
2268+
#
2269+
# The default value is "true" to include message details. Uncomment to only
2270+
# include the event ID and room ID in push notification payloads.
2271+
#
2272+
#include_content: false
22682273

22692274

22702275
# Spam checkers are third-party modules that can block specific actions

synapse/config/push.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PushConfig(Config):
2121
section = "push"
2222

2323
def read_config(self, config, **kwargs):
24-
push_config = config.get("push", {})
24+
push_config = config.get("push") or {}
2525
self.push_include_content = push_config.get("include_content", True)
2626

2727
pusher_instances = config.get("pusher_instances") or []
@@ -49,18 +49,23 @@ def read_config(self, config, **kwargs):
4949

5050
def generate_config_section(self, config_dir_path, server_name, **kwargs):
5151
return """
52-
# Clients requesting push notifications can either have the body of
53-
# the message sent in the notification poke along with other details
54-
# like the sender, or just the event ID and room ID (`event_id_only`).
55-
# If clients choose the former, this option controls whether the
56-
# notification request includes the content of the event (other details
57-
# like the sender are still included). For `event_id_only` push, it
58-
# has no effect.
59-
#
60-
# For modern android devices the notification content will still appear
61-
# because it is loaded by the app. iPhone, however will send a
62-
# notification saying only that a message arrived and who it came from.
63-
#
64-
#push:
65-
# include_content: true
52+
## Push ##
53+
54+
push:
55+
# Clients requesting push notifications can either have the body of
56+
# the message sent in the notification poke along with other details
57+
# like the sender, or just the event ID and room ID (`event_id_only`).
58+
# If clients choose the former, this option controls whether the
59+
# notification request includes the content of the event (other details
60+
# like the sender are still included). For `event_id_only` push, it
61+
# has no effect.
62+
#
63+
# For modern android devices the notification content will still appear
64+
# because it is loaded by the app. iPhone, however will send a
65+
# notification saying only that a message arrived and who it came from.
66+
#
67+
# The default value is "true" to include message details. Uncomment to only
68+
# include the event ID and room ID in push notification payloads.
69+
#
70+
#include_content: false
6671
"""

0 commit comments

Comments
 (0)