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

core/run/views: Add --notify and --no-notify flags as a command-line argument for ZT #964

Closed
wants to merge 3 commits into from

Conversation

zee-bit
Copy link
Member

@zee-bit zee-bit commented Mar 27, 2021

This PR adds new command-line configurations for ZT - the --notify and --no-notify flags. These should specify whether the notifications will be enabled in the current session or not respectively. If these flags are used as a command-line argument then the corresponding value in the zuliprc file is overridden by its value for the current session.

The attribute of this config is also shown in the terminal while ZT is loading, and in the About menu when it has loaded.

@zulipbot zulipbot added the size: M [Automatic label added by zulipbot] label Mar 27, 2021
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

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

@zee-bit From the brief discussion in the stream I'm open to this option on the command-line 👍

However, I'm wondering if we want to have something along the lines of --notify and no-notify like we do for autohide? I know that currently doesn't parallel the valid values, but requiring --key=value when there are only two values makes it more verbose and possibly extra understanding of how there are two parts (key + value), rather than just an option.

Re autohide, I think it would be reasonable to add additional values there so we also can have autohide=enabled|disabled in the config?

The commits are quite small, but I appreciate the clarity of keeping each change isolated 👍

Comment on lines 236 to 237
notify=self.notify_enabled,
autohide_enabled=self.autohide,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This naming is inconsistent.

@neiljp neiljp added the PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback label Mar 28, 2021
This commit adds new command-line arguments for notify and no-notify
that corresponds to desktop notifications being enabled or disabled
in the current session, respectively. This should allow the user to
specify a notify option and override its corresponding value in the
zuliprc.
This commit is a potential prep for #T900, that enables modifying
Stream notification settings in a running session.

Tests added.
This commit shows the configuration for notify option that the current
ZT session is loaded with. If no command-line argument for notify
was passed, then it checks for the config in zuliprc file(if present),
else uses the default value.

Tests amended.
@zulipbot zulipbot added size: L [Automatic label added by zulipbot] and removed size: M [Automatic label added by zulipbot] labels Mar 28, 2021
@zee-bit zee-bit changed the title core/run/views: Add --notify flag as a command-line argument for ZT core/run/views: Add --notify and --no-notify flags as a command-line argument for ZT Mar 28, 2021
@zee-bit
Copy link
Member Author

zee-bit commented Mar 28, 2021

@neiljp PR has been updated.
Re autohide, I wasn't sure if you wanted me to implement those changes in this PR itself?

@zulipbot add "PR needs review"
@zulipbot remove "PR awaiting update"

@zulipbot zulipbot added PR needs review PR requires feedback to proceed and removed PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback labels Mar 28, 2021
@@ -49,7 +49,7 @@ def __init__(self, config_file: str, maximum_footlinks: int,
self.color_depth = color_depth
self.in_explore_mode = in_explore_mode
self.autohide = autohide
self.notify_enabled = notify
self.notify = notify
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's leave the controller attribute descriptive too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(I noticed this since this commit now modifies more files than indicated in the commit)

('Color depth', str(color_depth))])
('Color depth', str(color_depth)),
('Notifications',
'enabled' if notify_enabled else 'disabled')])
Copy link
Collaborator

Choose a reason for hiding this comment

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

You added some good trailing commas; it'd be good if we could have one here too.

Copy link
Member Author

@zee-bit zee-bit Mar 29, 2021

Choose a reason for hiding this comment

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

I have added the trailing comma here as requested, but note that it won't make the diff smaller on adding extra fields(?), since the linter forced me to add extra whitespace after the comma. :)

Add Notifications status(i.e. "enabled" or "disabled") in Application
configuration section of About menu.
A user can now check the notification configuration that the current
ZT session is loaded with.

Tests amended.
@neiljp
Copy link
Collaborator

neiljp commented Mar 30, 2021

@zee-bit Thanks for the update - I merged manually with a few minor textual changes to the commit text, and I just bumped the brackets onto the following line to solve the whitespace issue you mentioned 🎉

@neiljp neiljp closed this Mar 30, 2021
@neiljp neiljp added this to the Next Release milestone Mar 30, 2021
@zee-bit zee-bit deleted the add-notify-cli-arg branch July 5, 2021 15:45
@neiljp neiljp added area: config enhancement New feature or request and removed PR needs review PR requires feedback to proceed labels Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: config enhancement New feature or request size: L [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants