-
Notifications
You must be signed in to change notification settings - Fork 911
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
Add status filter to user's note page #5297
base: master
Are you sure you want to change the base?
Conversation
5670d46
to
0d0045e
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.
In addition to the inline comment this could do with tests at the controller or system level rather than just testing the model method.
app/models/note.rb
Outdated
else | ||
all | ||
end | ||
} |
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.
Rather than trying to handle the all case specially here I think I would make this much simpler, like the with_status
on the issue model, and then add an unless params[:status] == "all"
guard in the controller so that the filter isn't applied when all statuses are requested.
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.
Do we even need the scope? A similar scope for issues is not used by the issues controller:
@issues = @issues.where(:status => params[:status]) if params[:status].present? |
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.
Fixed and updated the PR. Since this is the only place using the scope, I removed it to simplify the code and maintain consistency. If a need arises, we can reintroduce it later.
Also, I’ve added a test in the controller to cover the basic status filtering functionality. Let me know if further tests are needed.
5b87c90
to
337d37e
Compare
337d37e
to
b56dc10
Compare
Description
This PR partly addresses #832 and serves as a smaller alternative to #5255 as suggested in comments. It aims to enhance user experience on user note pages by providing filtering functionality for notes by status. The
with_status
scope is added to theNote
model, and theNotesController
is updated accordingly. Default behavior remains unchanged since the status preselected value is set toAll
by default.How has this been tested?
Test for the new scope is added to note model test to ensure functionality is working as expected.
Screenshots