+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion addon/models/github-release.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo } from 'ember-data/relationships';
import { deprecate } from '@ember/application/deprecations';
import { computed } from '@ember/object';

export default Model.extend({
name: attr('string'),
Expand All @@ -18,6 +20,10 @@ export default Model.extend({
createdAt: attr('date'),
publishedAt: attr('date'),

user: belongsTo('github-user', { inverse: null }),
author: belongsTo('github-user', { inverse: null }),
user: computed(function() {
deprecate('The user property on the github-release model has been deprecated. Please use the author property.', false, { id: 'ember-data-github.release-author', until: '1.0.0' });
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@elwayman02 I had a thought that we could do something like this for renaming these properties in a backwards compatible way. If you like this I could go back and do this for those other props I renamed as well. Or we can just move forward knowing we have some minor breaking changes.

screen shot 2018-02-12 at 07 54 04

Copy link
Owner

Choose a reason for hiding this comment

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

Yea this seems like a fine way to being able to release these changes in advance. Then for v1.0 we can remove the backwards-compatible stuff.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Perfect, I'll make another PR this week to re-add the properties I removed and deprecate them

return this.get('author');
}),
repository: belongsTo('github-repository')
});
2 changes: 1 addition & 1 deletion tests/acceptance/github-release-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test('getting a releases\' author', function (assert) {

return run(() => {
return store.queryRecord('githubRelease', { repo: 'user1/repository0', releaseId: '1' }).then((release) => {
return release.get('user').then(function (user) {
return release.get('author').then(function (user) {
assert.githubUserOk(user);
assert.equal(store.peekAll('githubUser').get('length'), 1, 'loads 1 user');
assert.equal(server.pretender.handledRequests.length, 2, 'handles 2 requests');
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载