Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help: add config to hide server host from help listing #1459

Merged
merged 2 commits into from
Apr 25, 2019

Conversation

HumorBaby
Copy link
Contributor

I have been disabling the help module because it shows the name of my server in a full .help listing. This would be okay if the bot connected directly to a public server, but if it goes through a private bouncer, it may not be desirable to share this information.

Of course I can modify help.py to prevent this, but I thought "Why not make it configurable?". So, here it is 🎉

A config section is defined for the help module (section called help, of course), which for now, only has one setting: show_server_host, a boolean that determines whether the server name will be printed or not; e.g., Command listing for ro-bot-o@znc.roboto.org (true) vs Command listing for ro-bot-o (false). A configure method was also added to provide config wizard support.

This required implementing cache validation of a sorts because a change in the setting would not have trigger a new help listing to be generated unless the total number of available commands changed somehow. I think this caching bust/validation implementation could also help #1451 if still needed.

@HumorBaby
Copy link
Contributor Author

HumorBaby commented Jan 26, 2019

Fiiinee.. ./checkstyle.sh fixes coming up!

sopel/modules/help.py Outdated Show resolved Hide resolved
@HumorBaby HumorBaby force-pushed the feat-help-hide-server branch 2 times, most recently from d9816b8 to 1f87da9 Compare March 30, 2019 00:45
Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

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

Docstring nitpicks, and a proposal for the setting cache. I'm mixing it up a bit…

sopel/modules/help.py Outdated Show resolved Hide resolved
sopel/modules/help.py Outdated Show resolved Hide resolved
sopel/modules/help.py Outdated Show resolved Hide resolved
sopel/modules/help.py Outdated Show resolved Hide resolved
Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

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

OK, I think going without a shutdown() method that removes the setting cache from memory makes sense. Reloading the module shouldn't reset the cached setting values, nor the cached pastebin URL. It makes sense to me right now, and it can easily be changed later if it stops making sense.

Maybe just fix the commit message format since the original and revising commits were made so far apart. Squashing would destroy that bit of history (feature development timeline), so I'm not actually inclined to ask for a straight-up rebase this time around.

@HumorBaby
Copy link
Contributor Author

Maybe just fix the commit message format...

Done.

@dgw
Copy link
Member

dgw commented Apr 23, 2019

Bleh, this needs rebasing. :/ It's #1451 what did it.

@HumorBaby HumorBaby force-pushed the feat-help-hide-server branch 2 times, most recently from 90e2552 to 2f47078 Compare April 23, 2019 19:59
@HumorBaby
Copy link
Contributor Author

Boy, that was a fun one 🙃

Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

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

If only I'd just hit "Merge" and not gone back for one final check to make sure the rebase didn't break anything obvious… Now we have more change requests. I guess @HumorBaby won't be bored today!

sopel/modules/help.py Outdated Show resolved Hide resolved
sopel/modules/help.py Show resolved Hide resolved
sopel/modules/help.py Outdated Show resolved Hide resolved
sopel/modules/help.py Outdated Show resolved Hide resolved
sopel/modules/help.py Show resolved Hide resolved
HumorBaby and others added 2 commits April 25, 2019 16:03
Adds a config section to help.py that has a setting to show the server host
in the first line of a full help listing. Defaults to true. Additionally
implements cache validation accounting for changes to config during runtime.
@HumorBaby
Copy link
Contributor Author

I guess @HumorBaby won't be bored today!

Can confirm... was not bored.

@HumorBaby HumorBaby requested a review from dgw April 25, 2019 20:13
Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

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

Yerp, gerd ter ger.

@dgw dgw merged commit a10c548 into sopel-irc:master Apr 25, 2019
dgw added a commit that referenced this pull request Apr 25, 2019
Regression introduced by #1459 (`dict.iteritems()` no longer exists in
Python 3; only `dict.items()` does, with the same internal behavior as
what `dict.iteritems()` did in Python 2)
@HumorBaby HumorBaby deleted the feat-help-hide-server branch August 28, 2019 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants