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

Rename redact_content option to include_content #2650

Merged
merged 5 commits into from
Nov 15, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions synapse/config/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@

from ._base import Config

import logging

from twisted.internet import reactor


logger = logging.getLogger(__name__)


class PushConfig(Config):
def read_config(self, config):
Expand All @@ -33,20 +26,20 @@ def read_config(self, config):
# 'email'section'. Check for the flag in the 'push' section, and log,
# but do not honour it to avoid nasty surprises when people upgrade.
if push_config.get("redact_content") is not None:
reactor.callWhenRunning(lambda: logger.warn(
print(
Copy link
Contributor

@krombel krombel Nov 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just logger.warn(<msg>) instead of the previous construct
(reactor.callWhenRunning(lambda: logger.warn(<msg>)))?
Shouldn't that be faster as well with the functionality that this message will be part of homeserver.log?
This is especially useful in the case when you run it as service and won't see any console-output

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point the logging hasn't been set up and we've not yet daemonized, and using print is consistent with where we do it elsewhere

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right. Good to know

"The push.redact_content content option has never worked. "
"Please set push.include_content if you want this behaviour"
))
)

# Now check for the one in the 'email' section and honour it,
# with a warning.
push_config = config.get("email", {})
redact_content = push_config.get("redact_content")
if redact_content is not None:
reactor.callWhenRunning(lambda: logger.warn(
print(
"The 'email.redact_content' option is deprecated: "
"please set push.include_content instead"
))
)
self.push_include_content = not redact_content

def default_config(self, config_dir_path, server_name, **kwargs):
Expand Down