Guestbook ID over 127 could not be assigned to a Dataset via the API - #12592
Guestbook ID over 127 could not be assigned to a Dataset via the API#12592stevenwinship wants to merge 1 commit into
Conversation
2d3e61f to
0b2888e
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
0b2888e to
ffe0582
Compare
This comment has been minimized.
This comment has been minimized.
ffe0582 to
8d8e544
Compare
This comment has been minimized.
This comment has been minimized.
23e3adf to
73ebe99
Compare
This comment has been minimized.
This comment has been minimized.
73ebe99 to
175f551
Compare
This comment has been minimized.
This comment has been minimized.
175f551 to
b8b68a6
Compare
|
|
📦 Pushed preview images as 🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
| final List<Guestbook> guestbooks = dataset.getOwner().getAvailableGuestbooks(); | ||
| for (Guestbook gb : guestbooks) { | ||
| if (gb.getId() == guestbook.getId()) { | ||
| if (gb.getId().equals(guestbook.getId())) { |
There was a problem hiding this comment.
This appears to work and FWIW: it's something my IDE flagged as suspicious, suggesting Object.equals() as a null-safe approach. Since this use is getting real db objects guaranteed not to be null, .equals seems fine.
Out of scope- this loop seems to iterate over all available guestbooks just to assure this guestbook is allowed. I think that could be found more cheaply by looking at guestbook.getDataverse() and seeing if that's one of the recursive dataset.getOwner() s.
Since this is straight forward and I also QAed it ( using SELECT setval('guestbook_id_seq', 129, true); to cause my second guestbook to have id 130 rather than creating that many guestbooks), I'll put this in QA and see at standup if that's sufficient to merge it.



What this PR does / why we need it: Guestbook ID over 127 could not be assigned to a Dataset via the API
Which issue(s) this PR closes:#12556
Special notes for your reviewer:
Suggestions on how to test this: See issue for how to reproduce.
Create Datataverse. Create over 200 Guestbooks. Create Dataset under Dataverse. Try to assign a Guestbook with id over 127 to the Dataset.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?: included
Additional documentation: