Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[ENG-4760] User secondary metadata #2031
[ENG-4760] User secondary metadata #2031
Changes from 4 commits
de2cb25
b4f816c
61b6624
4a77892
fe8e44b
ed5f7bc
6880aa9
18bc4dd
9cbf67b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 feels like a fragile way of fetching the user guid. Any thoughts/feedback on this would be appreciated!
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.
would recommend
startsWith
(instead ofincludes
) andslice
(instead ofreplace
), so the operation is anchored at the start of the string(does this happen other places? in backend code using IRIs as data, this sort of thing was common enough to warrant shared utility functions)
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 suppose this could be done fairly simply with the URL object type by doing something like
Although this approach feels a bit too naive to make into a generalized util function
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.
if you want to compare hosts, yeah the built-in
URL
seems better than parsing it yourself (tho you'd also need to extract the host fromosfUrl
, since it's a full url) -- at the moment i'm more a fan of the primitive startswith/slice approach for iris within namespaces (one way to look at osf-id (osf-guid)), tho there's also the complication of osf-urls that are not osf-ids but are still used as identifiers...or using
URL
and comparing hosts:(the two would have different behavior if there were ever an
osfUrl
that had a non-empty path, which might be a nice future to aim for (supporting folks who want to deploy an instance at a subroute under their own domain) but is not the present we're in)buuuut in any case, maybe the eventual helpful reusable thing would be a method on
IndexCardModel
to extract an osf-id fromthis.resourceIdentifier
and/orthis.resourceMetadata.identifier
(and maybe another method to fetch the ember-data model instance for it) -- no pressure to add that now, thoThere 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 would not have caught the subtle difference in these two approaches. I'll opt for the first one that uses
startsWith
, as I think there may be some cases where thepathname
approach may cause problems. Will add this guid-extration method and afetchOsfModel
, as I think that would be handy for possible future improvements