Remove all remaining app deprecations

This commit is contained in:
Curtis Ekstrom 2016-04-13 18:02:03 +02:00
parent dc34ab38e7
commit f8d05dea78
No known key found for this signature in database
GPG Key ID: CDE831E4F18FEB65
14 changed files with 33 additions and 26 deletions

View File

@ -1,6 +1,7 @@
import Ember from 'ember';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import getOwner from 'ember-getowner-polyfill';
import config from './config/environment';
Ember.MODEL_FACTORY_INJECTIONS = true;
@ -19,12 +20,8 @@ var App = Ember.Application.extend(Ember.Evented, {
podModulePrefix: config.podModulePrefix,
Resolver: Resolver,
lookup() {
return this.__container__.lookup.apply(this.__container__, arguments);
},
flash(options) {
return Travis.lookup('controller:flash').loadFlashes([options]);
return Ember.getOwner(Travis).lookup('controller:flash').loadFlashes([options]);
},
toggleSidebar() {

View File

@ -1,4 +1,5 @@
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
export default Ember.Controller.extend({
sync() {
@ -11,7 +12,7 @@ export default Ember.Controller.extend({
var user;
if ((user = this.get('model')) && user.get('isSyncing') && !user.get('syncedAt')) {
return Ember.run.scheduleOnce('routerTransitions', this, function() {
return this.container.lookup('router:main').send('renderFirstSync');
return Ember.getOwner(this).lookup('router:main').send('renderFirstSync');
});
}
}.observes('isSyncing', 'auth.currentUser')

View File

@ -1,6 +1,7 @@
import Ember from 'ember';
import Repo from 'travis/models/repo';
import Config from 'travis/config/environment';
import getOwner from 'ember-getowner-polyfill';
var sortCallback = function(repo1, repo2) {
// this function could be made simpler, but I think it's clearer this way
@ -76,7 +77,7 @@ var Controller = Ember.Controller.extend({
possiblyRedirectToGettingStartedPage() {
return Ember.run.scheduleOnce('routerTransitions', this, function() {
if (this.get('tab') === 'owned' && this.get('isLoaded') && this.get('repos.length') === 0) {
return this.container.lookup('router:main').send('redirectToGettingStarted');
return Ember.getOwner(this).lookup('router:main').send('redirectToGettingStarted');
}
});
},

View File

@ -2,16 +2,15 @@ import config from 'travis/config/environment';
import TravisPusher from 'travis/utils/pusher';
var PusherInitializer, initialize;
initialize = function(data) {
var application;
application = data.application;
initialize = function(applicationInstance) {
const app = applicationInstance.application;
if (config.pusher.key) {
application.pusher = new TravisPusher(config.pusher, data.container.lookup('service:ajax'));
application.register('pusher:main', application.pusher, {
app.pusher = new TravisPusher(config.pusher, applicationInstance.lookup('service:ajax'));
app.register('pusher:main', app.pusher, {
instantiate: false
});
application.inject('route', 'pusher', 'pusher:main');
return application.pusher.store = data.container.lookup('service:store');
app.inject('route', 'pusher', 'pusher:main');
return app.pusher.store = applicationInstance.lookup('service:store');
}
};

View File

@ -1,6 +1,7 @@
import Ember from 'ember';
import Model from 'travis/models/model';
import attr from 'ember-data/attr';
import getOwner from 'ember-getowner-polyfill';
var indexOf = [].indexOf;
@ -30,7 +31,7 @@ var Broadcast = Model.extend({
Broadcast.reopenClass({
seen: function() {
var seenBroadcasts;
seenBroadcasts = Travis.lookup('service:storage').getItem('travis.seen_broadcasts');
seenBroadcasts = Ember.getOwner(Travis).lookup('service:storage').getItem('travis.seen_broadcasts');
if (seenBroadcasts != null) {
seenBroadcasts = JSON.parse(seenBroadcasts);
}

View File

@ -1,6 +1,7 @@
import Ember from 'ember';
import config from './config/environment';
import Location from 'travis/utils/location';
import getOwner from 'ember-getowner-polyfill';
var Router = Ember.Router.extend({
location: function() {

View File

@ -1,6 +1,8 @@
import TravisRoute from 'travis/routes/basic';
import config from 'travis/config/environment';
import BuildFaviconMixin from 'travis/mixins/build-favicon';
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
export default TravisRoute.extend(BuildFaviconMixin, {
needsAuth: false,
@ -99,7 +101,7 @@ export default TravisRoute.extend(BuildFaviconMixin, {
error(error) {
var authController;
if (error === 'needs-auth') {
authController = this.container.lookup('controller:auth');
authController = Ember.getOwner(this).lookup('controller:auth');
authController.set('redirected', true);
return this.transitionTo('auth');
} else {

View File

@ -1,7 +1,9 @@
import TravisRoute from 'travis/routes/basic';
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
export default TravisRoute.extend({
setupController(controller) {
return this.container.lookup('controller:repos').activate('owned');
return Ember.getOwner(this).lookup('controller:repos').activate('owned');
}
});

View File

@ -1,5 +1,6 @@
import TravisRoute from 'travis/routes/basic';
import config from 'travis/config/environment';
import getOwner from 'ember-getowner-polyfill';
export default TravisRoute.extend({
renderTemplate() {

View File

@ -17,7 +17,7 @@ export default TravisRoute.extend(ScrollResetMixin, {
},
setupController(controller, model) {
this.container.lookup('controller:repos').activate('owned');
this.controllerFor('repos').activate('owned');
if (model && !model.get) {
model = this.get('store').find('repo', model.id);
}

View File

@ -1,9 +1,10 @@
import TravisRoute from 'travis/routes/basic';
import getOwner from 'ember-getowner-polyfill';
export default TravisRoute.extend({
setupController: function() {
$('body').attr('id', 'simple');
this.container.lookup('controller:repos').activate('owned');
this.controllerFor('repos').activate('owned');
return this._super.apply(this, arguments);
},
renderTemplate: function() {

View File

@ -1,5 +1,6 @@
import Ember from 'ember';
import config from 'travis/config/environment';
import getOwner from 'ember-getowner-polyfill';
var default_options;
jQuery.support.cors = true;
@ -64,7 +65,7 @@ export default Ember.Service.extend({
success = options.success || (function() {});
options.success = (data, status, xhr) => {
if (data != null ? data.flash : void 0) {
Travis.lookup('controller:flash').loadFlashes(data.flash);
Ember.getOwner(Travis).lookup('controller:flash').loadFlashes(data.flash);
}
if (data != null) {
delete data.flash;
@ -75,7 +76,7 @@ export default Ember.Service.extend({
options.error = (data, status, xhr) => {
console.log("[ERROR] API responded with an error (" + status + "): " + (JSON.stringify(data)));
if (data != null ? data.flash : void 0) {
Travis.lookup('controller:flash').pushObject(data.flash);
Ember.getOwner(Travis).lookup('controller:flash').pushObject(data.flash);
}
if (data != null) {
delete data.flash;

View File

@ -1,4 +1,6 @@
import config from 'travis/config/environment';
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
var ccXml, email, githubAdmin, githubCommit, githubNetwork, githubPullRequest,
githubRepo, githubWatchers, gravatarImage, plainTextLog, statusImage;
@ -33,7 +35,7 @@ githubAdmin = function(slug) {
statusImage = function(slug, branch) {
var token;
if (config.pro) {
token = Travis.__container__.lookup('controller:currentUser').get('model.token');
token = Ember.getOwner(Travis).lookup('controller:currentUser').get('model.token');
return (location.protocol + "//" + location.host + "/" + slug + ".svg?token=" + token) + (branch ? "&branch=" + branch : '');
} else {
return (location.protocol + "//" + location.host + "/" + slug + ".svg") + (branch ? "?branch=" + (encodeURIComponent(branch)) : '');
@ -48,7 +50,7 @@ ccXml = function(slug, branch) {
}
if (config.pro) {
delimiter = url.indexOf('?') === -1 ? '?' : '&';
token = Travis.__container__.lookup('controller:currentUser').get('model.token');
token = Ember.getOwner(Travis).lookup('controller:currentUser').get('model.token');
url = "" + url + delimiter + "token=" + token;
}
return url;

View File

@ -1,6 +1,4 @@
window.deprecationWorkflow = window.deprecationWorkflow || {};
window.deprecationWorkflow.config = {
workflow: [
{ handler: "silence", matchMessage: "Using `ApplicationInstance.container.lookup` is deprecated. Please use `ApplicationInstance.lookup` instead." },
]
workflow: []
};