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

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Nov 8, 2017

The redact_content option never worked because it read the wrong config
section. The PR introducing it
(#2301) had feedback suggesting the
name be changed to not re-use the term 'redact' but this wasn't
incorporated.

This reanmes the option to give it a less confusing name, and also
means that people who've set the redact_content option won't suddenly
see a behaviour change when upgrading synapse, but instead can set
include_content if they want to.

This PR also updates the wording of the config comment to clarify
that this has no effect on event_id_only push.

Includes #2422

The redact_content option never worked because it read the wrong config
section. The PR introducing it
(#2301) had feedback suggesting the
name be changed to not re-use the term 'redact' but this wasn't
incorporated.

This reanmes the option to give it a less confusing name, and also
means that people who've set the redact_content option won't suddenly
see a behaviour change when upgrading synapse, but instead can set
include_content if they want to.

This PR also updates the wording of the config comment to clarify
that this has no effect on event_id_only push.

Includes #2422
@erikjohnston
Copy link
Member

Hmm, given the PRs I wouldn't be surprised if people were using redact_content anyway. Can we keep the check for email.redact_content as well? Maybe add a deprecation warning or something for bonus points, but meh.

@dbkr
Copy link
Member Author

dbkr commented Nov 8, 2017

Well, my thinking was to deliberately not read the old config option because that will mean that anyone who has set that option will suddenly see synapse's behaviour change when they upgrade: if this had worked at some point and then been broken, I'd agree, but it hasn't.

We could put in a big warning if you set the old config option?

@erikjohnston
Copy link
Member

It has worked though if you set email.redact_content? I honestly don't think people would notice the behaviour changing. I also think we might want to support push.redact_content, since that will still be in people's config files.

Is there a reason not to support it?

@dbkr
Copy link
Member Author

dbkr commented Nov 8, 2017

Oh I see, yes - we could support email.redact_content. I would vote for not supporting push.redact_content though as per above.

@erikjohnston
Copy link
Member

Sorry, I don't see the issue with supporting push.redact_content? If people turned it on expecting it to work I think it might be nice to actually fix support for it?

@dbkr
Copy link
Member Author

dbkr commented Nov 8, 2017

My issue is that I expect people will have turned it on when they set synapse up however long ago, saw everything worked, forgot all about it and are now going to have push change from under them when they upgrade.

# For modern android devices the notification content will still appear
# because it is loaded by the app. iPhone, however will send a
# notification saying only that a message arrived and who it came from.
#
#push:
# redact_content: false
# include_content: false
Copy link
Contributor

Choose a reason for hiding this comment

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

the default for include_content is true. IMO this should be here as well

Copy link
Member Author

Choose a reason for hiding this comment

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

as in the commented version should be include_content: true or the description should say the default is true, or both?

Copy link
Contributor

Choose a reason for hiding this comment

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

As this method generates the default snippet for the push config I would put include_content: true here (even uncommented)
Having a comment in the description is optional I think. But would not be bad :)

But his is just my "suggestion". I will accept what you think is best here 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this is probably sensible - done.

because we had to wait until the logger was set up
@@ -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

@dbkr dbkr merged commit 7190a55 into develop Nov 15, 2017
@hawkowl hawkowl deleted the dbkr/push_include_content_option branch September 20, 2018 13:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants