-
Notifications
You must be signed in to change notification settings - Fork 13
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 Dandiset star functionality with UI components #2123
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.
Very interesting!
I'm a dinosaur who's not ready to trust AI-generated code just yet, so I'll want to get careful reviews from @jjnesbitt and @mvandenburgh (both to identify problems with the code, and so we have team members with a mental model of how it works) before merging. Furthermore, I think this will benefit from some enhancements (like using a service layer to manage stars), as well as some minor stuff that I can push fixes for myself. Finally, I would like for @jtomeck to help out with the frontend design here as well.
Thanks @bendichter for kicking this feature off!
@waxlamp yes, I mentioned Cursor because I agree that this will need careful eyes on it before integrating. But looking at the changes the majority of them seem straightforward |
ok yeah the npm-related issues are my fault. I am used to installing with npm and having large automatically generated files as a result of that. I'll make sure to use yarn in the future. |
I don't know what to do about the remaining CI check failures |
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 for the work, @bendichter. I've done a first pass of this PR and identified some necessary changes, but nonetheless it's great to have the outline of this feature out of the way.
I'd be happy to address some of these changes myself, if that makes more sense. I'll still leave the comments either way.
@jjnesbitt thanks for the prompt and thorough review. I can confirm that I can replicate those UI bugs. I might have time to address them myself but feel free to take this over if you have the bandwidth to do so. |
I think I have the bandwidth, so today I can make a pass at changing someone of the things I mentioned. |
c2b200c
to
0d1aace
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'll also need to add audit events for starring/unstarring a dandiset.
For posterity: We met offline and agreed to exclude dandiset stars from audit events. |
- Introduced DandisetStar model and admin interface for managing starred Dandisets. - Implemented star/unstar actions in the DandisetViewSet and corresponding API endpoints. - Added star count and starred status to DandisetSerializer. - Created StarButton component for toggling star status in the UI. - Developed StarredDandisetsView to display Dandisets starred by the user. - Updated DandisetList and DandisetLandingView to include star functionality. - Enhanced DandisetFilterBackend to support ordering by star count.
- Updated test cases in test_dandiset.py and test_version.py to include 'star_count' and 'is_starred' fields in the expected responses. - Ensured consistency across various test scenarios for Dandiset and Version APIs regarding star functionality.
unique_together is deprecated
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.
@jjnesbitt just one point about the failure conditions for starring/unstarring. I think you could make an argument for either way (i.e., starring/unstarring is idempotent and always returns a 2xx as it is now, vs. verifying validity of the request and possibly rejecting it with a 4xx), any thoughts?
IMO the star/unstar operation should be idempotent. Raising an error in this case doesn't really provide us with much benefit. It can actually lead to an undesirable outcome in the following situation:
This is unnecessarily confusing to the user with no real upside. It's not like the user can do anything, and we couldn't really do anything either, except for try to prevent that situation from occurring in the first place. |
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 looks great, and I don't wish to hold up merge-and-deploy any longer, but I did have some questions and some minor suggestions in case they're useful.
Co-authored-by: Roni Choudhury <[email protected]>
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 a remaining suggestion about unifiying two functions, but I'm leaving that to your discretion -- this looks ready to go.
🚀 PR was released in |
Great work team. This is a really nice feature. I tested on staging and production, and it is working well. |
fix #1119
Feature developed with Cursor
I haven't been able to log in on my dev server so I can't test that behavior, but the unlogged in web UI and the admin interface appear to work as expected