-
Notifications
You must be signed in to change notification settings - Fork 63
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
Config to set /ignore and /notify #344
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @trevarj . Just did a quick pass, it looks great.
No support for /join or /connect command args
I wonder if we should also do that. We will need to implement command args anyway, and if we do that today the fields ignore
and notify
will be redundant, so perhaps we could just rely on command args, instead of having two ways of doing the same thing in the config (which raises questions like which one will have priority when in conflict).
If we can design a good syntax for command args then it should be a few lines of change in the config parser. We could use the same types and rest of the code.
@osa1 my problem with the command args approach was that it's not straightforward going from |
I was able to add parsing for
Need to think about this more I guess. Branch is here: https://github.com/trevarj/tiny/tree/default-ignore-notify-v2 |
From most recent commits:
@osa1 let me know if you get some time to try this out and can give some thoughts on the UX here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @trevarj . Just one quick pass for now, will review again in detail later. It would be good to revert unrelated changes in the meantime.
One question re: PR description:
Chan tabs: chan section -> server section -> defaults section -> current setting on server tab (maybe someone toggled the setting manually)
Shouldn't current tab setting have highest priority?
15e1879
to
0f7b9ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document how overriding notify
and ignore
(e.g. tab ignore
overrides server
and default
). I'll post a suggestion here.
format!("#{}", s) | ||
} else { | ||
s.to_string() | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big deal probably, but I wonder if we should expect user to get this right instead of inserting a #
for them. The problem is channel names can contain multiple #
s, not just one, but we assume one here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something I noticed other clients do, so I added it if there is no #
. It seems like a nicer UX, but we don't need to have it.
Hi, is this PR still going to be merged ? I was looking to know if it was possible to set |
Added the ability to configure /ignore and /notify defaults for tabs. The settings can be added under each chan, server or default section.
When joining a channel using the /join command, the tab is created before the server is actually joined so we can effectively set the channel config (ex. ignore the tab, set notifier). Due to this, I had to add handling for REPLY messages that occur when a channel cannot be joined but the tab has already been created. Now an error message shows on the chan tab, giving the reason why the chan can't be joined.
When an auto-join channel cannot be joined, it will send a client error message, so we open the tab and display the error message to the user.
0f7b9ed
to
6c4eb09
Compare
@Raphalex46 I've rebased with |
I've tested it a little bit, the only that I didn't manage to get working is the |
@Raphalex46 I made another commit with some fixes. You can do |
I can't test it right now but I will as soon as I can and I'll let you know then. |
Right, should work now. |
Yup, seems to work pretty much as expected. I suppose we have to wait to see if @osa1 is ok with merging this. I was also thinking, eventually, options like these could be expressed in the config file like this: join:
- name: "#tiny"
ignore: true
notify: messages right ? That way, configuration defaults could even be expressed for a whole server: servers:
- addr: irc.oftc.net
port: 6697
# ...
ignore: true
notify: messages |
@Raphalex46 thanks a lot for taking the time to test.
The reason why they are using a special parsing was so that it could be leveraged for on-the-fly
This should actually be working too.
I will write more thorough docs in the example |
Yes, I saw that you can join like that, and it totally justifies the parsing! I also did not see that you could put defaults like that for servers in the config file, so thanks for pointing that out. I just mentioned this because we have a YAML config file, and it seemed more satisfying to use that for the default config of the channels. You're right that this PR probably isn't the place to implement this, just wanted to put it out there before I forgot :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @trevarj!
Added some inline comments.
There are lots of formatting changes in the PR, could you revert those please?
I know we're inconsistent in ordering of imports, but for now if you could follow the conventions in files to keep the diff small that would be really appreaciated. We can then do a pass to format them if we want.
(I'll add a few more things)
Moved from osa1#344 into separate PR. Information on what this does can be found in this comment: https://github.com/osa1/tiny/pull/344/files#r706813943
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in #397:
-
We should store all tab settings in TUI settings so that when we need to create a tab we will be able to find the settings for the tab.
We still need to set tab settings on creation, to be able to implement
/join ... -ignore
etc. commands. -
Design question: if I update settings of a tab, then close it, and create the tab again, should I get the settings in the config or the updated settings?
- Option (1) Use the updated settings: We should not store the tab settings in
Tab
, get the settings from the config every time we need it. - Option (2) Use the settings from the config file: We should store the tab settings in
Tab
- Currently notification settings are stored in
Tab
, but forignore
we use the config. This needs to be consistent: either use both from the config (implements (1)), or store both inTab
(implements (2)).
- Option (1) Use the updated settings: We should not store the tab settings in
I don't feel strongly, but I think (1) is probably better.
Let's just go with option (1) so that the previous config for the tab is restored from I will make an attempt at the following:
|
- Removed ignore and notifier configs from `Tab` - Use proper YAML for `Chan` config - Reverted formatting changes
The above checklist is done, albeit with a bit of a hack to resolve an issue that I had that comes from moving This has lost its fun for me, so if anyone wants to help, now is the time 😩 |
Fixed toggling the tab config (/ignore and /notify) when on a server tab and also for when on a user tab. The hack is how we are storing user nicks as channel names in TabConfig. That can perhaps be refactored later to look nicer.
af4a8fa
to
f673fd8
Compare
I will try to take a look when I have the time, probably this week-end. |
Thanks @trevarj, I think this looks pretty good. Let's test this a little bit (the parts without unit tests) and merge. I will update README and CHANGELOG. |
Is there anything blocking merge? |
Sorry for the delay. I'll try to merge this this week. |
Added the ability to configure /ignore and /notify defaults for tabs.
The settings can be added under each chan, server or default section.
Overview:
ignore
under a chan then it will supersede the server'signore
, which will supersede theignore
underdefaults:
.Priority hierarchy (highest to lowest):
Server tab: server section -> defaults section -> hardcoded defaults (never ignore, notifier depends on conditional compilation, see
impl Default for Notifier
)Chan tabs: chan section -> server section -> defaults section -> current setting on server tab (maybe someone toggled the setting manually)
User tabs: never ignore, notifier is always
Messages
(pre-existing behavior)If acceptable, closes #118