Skip to content
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

fix deprecated import of getOwner #1124

Merged
merged 1 commit into from
Dec 9, 2016
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions addon/internal-session.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';

const {
RSVP,
Expand All @@ -12,7 +11,8 @@ const {
assert,
deprecate,
set,
debug
debug,
getOwner
} = Ember;
const assign = emberAssign || merge;

Expand Down
3 changes: 1 addition & 2 deletions addon/mixins/application-route-mixin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
import Configuration from './../configuration';

const { inject, Mixin, A, run: { bind }, testing, computed } = Ember;
const { inject, Mixin, A, run: { bind }, testing, computed, getOwner } = Ember;

/**
The mixin for the application route; __defines methods that are called when
Expand Down
3 changes: 1 addition & 2 deletions addon/mixins/authenticated-route-mixin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
import Configuration from './../configuration';

const { inject: { service }, Mixin, assert, computed } = Ember;
const { inject: { service }, Mixin, assert, computed, getOwner } = Ember;

/**
__This mixin is used to make routes accessible only if the session is
Expand Down
3 changes: 1 addition & 2 deletions addon/mixins/unauthenticated-route-mixin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
import Configuration from './../configuration';

const { inject: { service }, Mixin, assert, computed } = Ember;
const { inject: { service }, Mixin, assert, computed, getOwner } = Ember;

/**
__This mixin is used to make routes accessible only if the session is
Expand Down
3 changes: 1 addition & 2 deletions addon/services/session.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';

const SESSION_DATA_KEY_PREFIX = /^data\./;

const { computed, A, Service, Evented } = Ember;
const { computed, A, Service, Evented, getOwner } = Ember;

/**
__The session service provides access to the current session as well as
Expand Down
3 changes: 1 addition & 2 deletions addon/session-stores/adaptive.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* global localStorage */
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
import Base from 'ember-simple-auth/session-stores/base';
import LocalStorage from 'ember-simple-auth/session-stores/local-storage';
import Cookie from 'ember-simple-auth/session-stores/cookie';

const { computed, inject: { service } } = Ember;
const { computed, inject: { service }, getOwner } = Ember;

const LOCAL_STORAGE_TEST_KEY = '_ember_simple_auth_test_key';

Expand Down
3 changes: 1 addition & 2 deletions addon/session-stores/cookie.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Ember from 'ember';
import BaseStore from './base';
import objectsAreEqual from '../utils/objects-are-equal';
import getOwner from 'ember-getowner-polyfill';

const { RSVP, computed, inject: { service }, run: { next, cancel, later, scheduleOnce }, isEmpty, typeOf, testing, isPresent, K, A } = Ember;
const { RSVP, computed, inject: { service }, run: { next, cancel, later, scheduleOnce }, isEmpty, typeOf, testing, isPresent, K, A, getOwner } = Ember;

const persistingProperty = function(beforeSet = K) {
return computed({
Expand Down
3 changes: 1 addition & 2 deletions addon/session-stores/local-storage.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* global localStorage */
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
import BaseStore from './base';
import objectsAreEqual from '../utils/objects-are-equal';

const { RSVP, $: jQuery, computed } = Ember;
const { RSVP, $: jQuery, computed, getOwner } = Ember;

/**
Session store that persists data in the browser's `localStorage`.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"ember-cli-import-polyfill": "^0.2.0",
"ember-cli-is-package-missing": "^1.0.0",
"ember-cookies": "^0.0.10",
"ember-getowner-polyfill": "^1.0.1",
"ember-getowner-polyfill": "^1.1.0",
Copy link
Member

Choose a reason for hiding this comment

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

This is still needed but in a later version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed that because of ember-getowner-polyfill is not required for Ember 2.3.0 and later, please remove from your package.json`` at build time, but I think if you want to keep ember-simple-auth compatible with ember 1.12+ this dependency is required, right ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we'll want to maintain the current compatibility unless not possible anymore.

"ember-network": "^0.3.0",
"silent-error": "^1.0.0"
},
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/internal-session-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import InternalSession from 'ember-simple-auth/internal-session';
import EphemeralStore from 'ember-simple-auth/session-stores/ephemeral';
import Authenticator from 'ember-simple-auth/authenticators/base';

const { RSVP, K, run: { next } } = Ember;
const { RSVP, K, run: { next }, setOwner } = Ember;

describe('InternalSession', () => {
let session;
Expand All @@ -19,7 +19,8 @@ describe('InternalSession', () => {
container = { lookup() {} };
store = EphemeralStore.create();
authenticator = Authenticator.create();
session = InternalSession.create({ store, container });
session = InternalSession.create({ store });
setOwner(session, container);
sinon.stub(container, 'lookup').withArgs('authenticator').returns(authenticator);
});

Expand Down
5 changes: 3 additions & 2 deletions tests/unit/services/session-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { expect } from 'chai';
import sinon from 'sinon';
import Session from 'ember-simple-auth/services/session';

const { ObjectProxy, Evented, run: { next }, set } = Ember;
const { ObjectProxy, Evented, run: { next }, set, setOwner } = Ember;

describe('SessionService', () => {
let sessionService;
Expand All @@ -21,7 +21,8 @@ describe('SessionService', () => {
};
let container = { lookup() {} };
sinon.stub(container, 'lookup').withArgs('authorizer').returns(authorizer);
sessionService = Session.create({ container, session });
sessionService = Session.create({ session });
setOwner(sessionService, container);
});

it('forwards the "authenticationSucceeded" event from the session', (done) => {
Expand Down