-
Notifications
You must be signed in to change notification settings - Fork 3
Enable to add comments #36
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
Enable to add comments #36
Conversation
ishikawa999
left a comment
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 have checked the code and verified that it works.
It looks good.
I especially liked the fact that having separate allowed_ips_with_comments and allowed_ips does not affect processing speed because there is no need to move the process of excluding comments when actually accessing the site.
Will changes to util.rake create another pull request?
|
Thanks for the review @ishikawa999.
I will add a commit to this PR. |
|
@ishikawa999 |
Sorry for the late review. I don't think there is any problem. |
maeda-m
left a comment
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.
@takenory
Thank you for the pull request.
It's great that the 'Allowed IP addresses' becomes easier to manage with effective commenting. I have confirmed that it works in my environment below. I was able to register an example of #30 in the browser.
Environment:
RedMica version 2.4.1.stable (based on Redmine 5.1.1.devel)
Ruby version 3.2.2-p53 (2023-03-30) [x86_64-linux]
Rails version 6.1.7.6
Environment development
Database adapter PostgreSQL
I confirmed that delete and show_with_comments in util.rake work even with comments.
That's fantastic 👍
I have one suggestion for util.rake. It would be great to have add_with_comments similar to show_with_comments for add. Having a CLI that can also add comments like the following would be convenient for me, as I won't need to launch a browser.
Usage:
$ bin/rails redmine_ip_filter:filters:add_with_comments ADDR_WITH_COMMENTS='
> # Our offices
> 192.0.2.1 # headquarter
> 192.0.2.100 # branch A
>
> 198.51.100.21 # Foo Corporation
> 'Example implementation:
desc 'Add IP addresses to the allowed IP addresses with comments'
task :add_with_comments => :environment do
filter_rule = FilterRule.find_or_default
address_with_comments = ENV['ADDR_WITH_COMMENTS']
if address_with_comments.blank?
abort 'IP addresses to add must be specified with ADDR_WITH_COMMENTS environment variable'
else
filter_rule.allowed_ips = ([filter_rule.allowed_ips_with_comments, address_with_comments]).join("\n")
end
unless filter_rule.save
STDERR.puts filter_rule.errors.messages[:base]
exit 1
end
puts "ADD:\n#{address_with_comments}"
endI would appreciate your opinion on this.
maeda-m
left a comment
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 to all the reviewers! |
This is a feature addition to realize issue #30.