[Feature] Changes needed for reviews to work with ember-preprints#272
Conversation
* Update models for reviews API * ReviewLog adapter and serializer * Fix log creator model
* Include reviewable when creating review logs * Add title/contributors fields to preprint model * Clean up serializing relationships
* Rename `review-log` to `action` * plac8 flake8 * Fix test errors
jamescdavis
left a comment
There was a problem hiding this comment.
Please refactor ObjectPromiseProxy stuff in the currentUser service
| // 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]); | ||
| } | ||
| }), |
There was a problem hiding this comment.
Refactor to use a computed property that returns a ObjectPromiseProxy simliar to: https://gist.github.com/jpadilla/30a6eedf3516fb13f9abbee325404171
|
|
||
| doiUrl: Ember.computed('doi', function() { | ||
| return `https://dx.doi.org/${this.get('doi')}`; | ||
| }), |
There was a problem hiding this comment.
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
|
@jamescdavis changes made, thanks! |
…r's add page (#11) * Apply requested changes * rename * Apply requested changes * Fix * minor change * Apply requested change * Restore comment * Update search link
jamescdavis
left a comment
There was a problem hiding this comment.
This looks really nice! Looks good-to-go to me!
| return ObjectPromiseProxy.create({ | ||
| promise: this.load().catch(() => null), | ||
| }); | ||
| }), |
There was a problem hiding this comment.
This feels like a much cleaner solution. It's also easier to understand conceptually. 👍
| return text | ||
| .replace(/({{year}})/g, year) | ||
| .replace(/({{copyrightHolders}})/g, copyright_holders.join(', ')); | ||
| }), |
There was a problem hiding this comment.
This is much better doing this here!
| uniqueSubjects: Ember.computed('subjects', function() { | ||
| if (!this.get('subjects')) return []; | ||
| return this.get('subjects').reduce((acc, val) => acc.concat(val), []).uniqBy('id'); | ||
| }), |
| }; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Thank you for centralizing this! ❤️
|
Note that I resolved conflicts on github, so you'll need to pull first before you add any additional commits. |
Ticket
Purpose
Sister PRs:
CenterForOpenScience/ember-osf-preprints#454
CenterForOpenScience/osf.io#7708
Summary of changes
Testing notes