Skip to content

Commit

Permalink
CR feedback; Add test selector
Browse files Browse the repository at this point in the history
  • Loading branch information
futa-ikeda committed Oct 20, 2023
1 parent ed5f7bc commit 6880aa9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
16 changes: 4 additions & 12 deletions app/models/index-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,19 @@ export default class IndexCardModel extends Model {

@dropTask
@waitFor
async getOsfModel() {
async getOsfModel(options?: object) {
const identifier = this.resourceIdentifier;
if (identifier && this.osfModelType) {
const guid = this.guidFromIdentifierList(identifier);
const relatedCounts = this.osfModelType === 'user' ? 'nodes,registrations,preprints' : '';
if (guid) {
const osfModel = await this.store.findRecord(this.osfModelType, guid, {
adapterOptions: {
query: {
related_counts: relatedCounts,
},
},
reload: true,
});
const osfModel = await this.store.findRecord(this.osfModelType, guid, options);
this.osfModel = osfModel;
}
}
}

guidFromIdentifierList(ids: string[]) {
for (const iri of ids) {
guidFromIdentifierList() {
for (const iri of this.resourceIdentifier) {
if (iri && iri.startsWith(osfUrl)) {
const pathSegments = iri.slice(osfUrl.length).split('/').filter(Boolean);
if (pathSegments.length === 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ as |layout|>
<SearchResultCard @result={{item}} />
{{else}}
<div local-class='no-results'>
<p>{{t 'search.no-results'}}</p>
<p data-test-search-page-no-results>{{t 'search.no-results'}}</p>
</div>
{{/each}}
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ export default class UserSecondaryMetadata extends Component<Args> {
@task
@waitFor
async getOsfUserModel() {
await taskFor(this.args.result.indexCard.get('getOsfModel')).perform();
const options = {
adapterOptions: {
query: {
related_counts: 'nodes,registrations,preprints',
},
},
reload: true,
};
await taskFor(this.args.result.indexCard.get('getOsfModel')).perform(options);
}
}

0 comments on commit 6880aa9

Please sign in to comment.