-
Notifications
You must be signed in to change notification settings - Fork 97
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
Fixes #7665 - added manage command to user mail notifications #513
Conversation
88a983e
to
4c47da8
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.
Thanks, @yifatmakias for keeping this going! Commands seem to be working.
Few inline suggestions though.
field :name, _('Name') | ||
field :description, _('Description') | ||
field :interval, _('Interval') | ||
field :mail_query, _('Mail query') unless :mail_query.nil? |
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.
What exactly you want to achieve here?
:mail_query.nil?
is always false
.
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.
Only with one type of mail notification, there is a mail query field so I thought this way it will show the field only when it is relevant. In a second check, the column will appear all the time, if there is a mail query it will appear in the column, if not it will be empty.
long story short - I removed the unless part it was redundant.
@@ -0,0 +1,32 @@ | |||
require File.join(File.dirname(__FILE__), 'test_helper') | |||
|
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.
❤️
I'd also prefer to write just one test per PR, but if we've got updated test data and more than one command, then it will be nice to cover them as well.
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.
I added more tests to all of the commands. You are definitely right there should be at least one test to each command.
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, @yifatmakias! Few more little nitpicks and I stop bothering you :D
field :name, _('Name') | ||
field :description, _('Description') | ||
field :interval, _('Interval') | ||
field :mail_query, _('Mail query') |
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.
Actually, if you want to hide mail_query
field you can specify hide_blank
option:
field :mail_query, _('Mail query'), Fields::Field, hide_blank: true
. This will hide the field if value for it is nil
. Although it doesn't work for table output. So, it's up to you whether have it or not.
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.
I don't see a reason to add this if it does not work for table output. Do you?
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.
Well, it works for base, csv and other outputs, which are used more for automation purposes. I don't see much usage of this option in the project anyway, so we can leave it as it is now.
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.
Sounds good to me :)
Thanks, @yifatmakias! All seems to be ready for merge, so merging this one. |
(cherry picked from commit 4bcbcd7)
This PR is blocked by another PR:
theforeman/foreman#7549