Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

[Feature] Changes needed for reviews to work with ember-preprints#272

Merged
aaxelb merged 26 commits into
CenterForOpenScience:developfrom
aaxelb:feature/reviews-minimal
Oct 23, 2017
Merged

[Feature] Changes needed for reviews to work with ember-preprints#272
aaxelb merged 26 commits into
CenterForOpenScience:developfrom
aaxelb:feature/reviews-minimal

Conversation

@aaxelb

@aaxelb aaxelb commented Sep 14, 2017

Copy link
Copy Markdown
Contributor

Ticket

Purpose

Sister PRs:
CenterForOpenScience/ember-osf-preprints#454
CenterForOpenScience/osf.io#7708

Summary of changes

Testing notes

@aaxelb aaxelb changed the title [WIP][Feature] Changes required for reviews to work with ember-preprints [WIP][Feature] Changes needed for reviews to work with ember-preprints Sep 15, 2017
@aaxelb aaxelb changed the title [WIP][Feature] Changes needed for reviews to work with ember-preprints [Feature] Changes needed for reviews to work with ember-preprints Sep 15, 2017

@jamescdavis jamescdavis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refactor ObjectPromiseProxy stuff in the currentUser service

Comment thread addon/services/current-user.js Outdated
// HACK: We need to use the original setter, which is in a closure (go figure), to make the PromiseProxyMixin work
return Ember.PromiseProxyMixin.mixins[0].properties.promise._setter.apply(this, [key, value]);
}
}),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to use a computed property that returns a ObjectPromiseProxy simliar to: https://gist.github.com/jpadilla/30a6eedf3516fb13f9abbee325404171

Comment thread addon/models/preprint.js Outdated

doiUrl: Ember.computed('doi', function() {
return `https://dx.doi.org/${this.get('doi')}`;
}),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not necessary as the doi url is in preprint.links.
Depending on which DOI you need:
preprint.links.doi - peer-reviewed article DOI
preprint.links.preprint_doi - DOI for the preprint itself

@aaxelb

aaxelb commented Sep 19, 2017

Copy link
Copy Markdown
Contributor Author

@jamescdavis changes made, thanks!

@jamescdavis jamescdavis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really nice! Looks good-to-go to me!

return ObjectPromiseProxy.create({
promise: this.load().catch(() => null),
});
}),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a much cleaner solution. It's also easier to understand conceptually. 👍

Comment thread addon/models/preprint.js
return text
.replace(/({{year}})/g, year)
.replace(/({{copyrightHolders}})/g, copyright_holders.join(', '));
}),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much better doing this here!

Comment thread addon/models/preprint.js
uniqueSubjects: Ember.computed('subjects', function() {
if (!this.get('subjects')) return [];
return this.get('subjects').reduce((acc, val) => acc.concat(val), []).uniqBy('id');
}),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better in the model. 👍

};
}
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for centralizing this! ❤️

@jamescdavis

Copy link
Copy Markdown
Member

Note that I resolved conflicts on github, so you'll need to pull first before you add any additional commits.

@aaxelb
aaxelb merged commit 588b8b6 into CenterForOpenScience:develop Oct 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants