-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Remove "parent" in tag.rb #9404
Conversation
Codecov Report
@@ Coverage Diff @@
## main #9404 +/- ##
=======================================
Coverage ? 58.44%
=======================================
Files ? 98
Lines ? 5985
Branches ? 0
=======================================
Hits ? 3498
Misses ? 2487
Partials ? 0 |
@jywarren kindly review if I made the correct changes in |
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.
Gosh, love seeing all this code go away!
I think i found a small mistake at before_action
and suggested a fix. I hope that resolves the tests but we can look closer at what goes wrong in the tests if not!
Thank you very much and apologies for the slow review. Please feel free to highlight PRs that need review in the chatroom at https://gitter.im/publiclab/publiclab if we miss them, and thanks for your patience!!
@@ -1,6 +1,5 @@ | |||
class TagController < ApplicationController | |||
respond_to :html, :xml, :json, :ics | |||
before_action :require_user, only: %i(create delete add_parent) |
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.
Hi, actually here I believe we need to remove just the add_parent
part, but keep the rest of the line!
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.
Oh ok, got it!
order = 'node_revisions.timestamp DESC' | ||
order = 'created DESC' if type == 'note' | ||
Node.where('node.nid IN (?)', (nodes + parents).collect(&:nid)) | ||
Node.where('node.nid IN (?)', nodes.collect(&:nid)) |
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.
Nicely done here! Actually we should be able to remove the comment on line 103 too, also related to parenting:
# .where('term_data.name IN (?) OR term_data.parent in (?)', tagnames, tagnames) # greedily fetch children
@@ -342,13 +333,13 @@ def self.tagged_nodes_by_author(tagname, user_id) | |||
if tagname[-1..-1] == '*' | |||
@wildcard = true | |||
Node.includes(:node_tag, :tag) | |||
.where('term_data.name LIKE(?) OR term_data.parent LIKE (?)', tagname[0..-2] + '%', tagname[0..-2] + '%') | |||
.where('term_data.name LIKE(?)', tagname[0..-2] + '%') |
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.
Nice, so much simpler!
I don't know why there are conflicts though. It seems like it was just the code I removed. |
@jcads, the conflict seems related to the tests https://github.com/publiclab/plots2/pull/9404/conflicts |
Code Climate has analyzed commit cc8274a and detected 1 issue on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Awesome work, thank you so much!!!! |
* remove parent publiclab#9403 * remove "parent" * Fix test errors
* remove parent publiclab#9403 * remove "parent" * Fix test errors
Fixes #9403
Remove:
plots2/app/controllers/tag_controller.rb
Lines 473 to 486 in ee46fe0
plots2/config/routes.rb
Line 209 in c188b97
plots2/app/controllers/tag_controller.rb
Line 3 in ee46fe0
Removing the above should cause the following tests to fail, so remove relevant tests in:
plots2/test/unit/node_tag_test.rb
plots2/test/functional/tag_controller_test.rb
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
@publiclab/reviewers
for help, in a comment below