Skip to content

Commit

Permalink
Remove route action helper addon (#1924)
Browse files Browse the repository at this point in the history
This is throwing deprecations as of Ember 3.6. It’s not that
widely-used in the application and route actions aren’t that
favoured in the RFC discussion, so we decided to remove it.

emberjs/rfcs#394
  • Loading branch information
backspace authored Dec 11, 2018
1 parent c88390b commit 9833724
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 78 deletions.
6 changes: 0 additions & 6 deletions app/components/owner-not-found.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,4 @@ import { inject as service } from '@ember/service';
export default Component.extend({
auth: service(),
features: service(),

actions: {
signIn() {
this.get('signIn')();
}
}
});
2 changes: 1 addition & 1 deletion app/components/repository-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default Component.extend({

showMyRepositories: function () {
this.set('tabStates.sidebarTab', 'owned');
this.attrs.showRepositories();
this.router.transitionTo('index');
},

onQueryChange(query) {
Expand Down
9 changes: 0 additions & 9 deletions app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,6 @@ export default TravisRoute.extend(BuildFaviconMixin, KeyboardShortcuts, {
return true;
}
},

showRepositories() {
this.transitionTo('index');
},

viewSearchResults(query) {
this.transitionTo('search', query);
}

},

afterSignIn() {
Expand Down
12 changes: 12 additions & 0 deletions app/services/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Promise as EmberPromise } from 'rsvp';
import Service, { inject as service } from '@ember/service';
import config from 'travis/config/environment';
import { alias } from '@ember/object/computed';
import { getOwner } from '@ember/application';

import URLPolyfill from 'travis/utils/url';

Expand Down Expand Up @@ -285,4 +286,15 @@ export default Service.extend({
}),

permissions: alias('currentUser.permissions'),

actions: {
signIn(runAfterSignIn) {
let applicationRoute = getOwner(this).lookup('route:application');
applicationRoute.send('signIn', runAfterSignIn);
},

signOut() {
this.signOut();
}
}
});
2 changes: 1 addition & 1 deletion app/templates/components/zendesk-request-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<button
title="Sign into Travis CI"
class="hero-button"
{{action (route-action 'signIn' false)}}
{{action (action 'signIn' false target=auth)}}
data-test-zendesk-form-log-in-button
>
{{svg-jar 'icon-repooctocat' }} Sign in with GitHub
Expand Down
4 changes: 1 addition & 3 deletions app/templates/getting-started.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
{{#if auth.signedIn}}
{{#unless features.dashboard}}
<aside id="left" class="{{unless auth.signedIn 'hidden'}}">
{{repository-sidebar
showRepositories=(route-action 'showRepositories')
viewSearchResults=(route-action 'viewSearchResults')}}
{{repository-sidebar}}
</aside>
{{/unless}}
{{/if}}
Expand Down
8 changes: 3 additions & 5 deletions app/templates/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@
{{#if auth.signedIn}}
{{#unless features.dashboard}}
<aside id="left" class="{{unless auth.signedIn 'hidden'}}">
{{repository-sidebar
showRepositories=(route-action 'showRepositories')
viewSearchResults=(route-action 'viewSearchResults')}}
{{repository-sidebar}}
</aside>
{{/unless}}
{{/if}}
</div>
{{else}}
<div class='wrapper centered'>
{{component landingPage
signIn=(route-action 'signIn')
signOut=(route-action 'signOut')}}
signIn=(action 'signIn' target=auth)
signOut=(action 'signOut' target=auth)}}
</div>
{{/if}}
2 changes: 1 addition & 1 deletion app/templates/owner-error.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#error-page-layout}}
{{owner-not-found ownerLogin=model.ownerName signIn=(route-action 'signIn')}}
{{owner-not-found ownerLogin=model.ownerName}}
{{/error-page-layout}}
4 changes: 1 addition & 3 deletions app/templates/repo.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
{{#if auth.signedIn}}
{{#unless features.dashboard}}
<aside id="left" class="{{unless auth.signedIn 'hidden'}}">
{{repository-sidebar
showRepositories=(route-action 'showRepositories')
viewSearchResults=(route-action 'viewSearchResults')}}
{{repository-sidebar}}
</aside>
{{/unless}}
{{/if}}
Expand Down
4 changes: 1 addition & 3 deletions app/templates/search.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
{{#if auth.signedIn}}
{{#unless features.dashboard}}
<aside id="left" class="{{unless auth.signedIn 'hidden'}}">
{{repository-sidebar
showRepositories=(route-action 'showRepositories')
viewSearchResults=(route-action 'viewSearchResults')}}
{{repository-sidebar}}
</aside>
{{/unless}}
{{/if}}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/signin.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<h1 class="content-title auth">We're so glad you're here!</h1>
<h2 class="content-subtitle">Please sign in to view your repositories.</h2>
<p>
<button type="button" {{action (route-action 'signIn')}} title="Sign into Travis CI" class="content-button">Sign in with GitHub</button>
<button type="button" {{action (action 'signIn' target=auth)}} title="Sign into Travis CI" class="content-button">Sign in with GitHub</button>
</p>
{{/if}}

Expand Down
48 changes: 4 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"ember-qunit": "^4.0.0",
"ember-qunit-nice-errors": "1.2.0",
"ember-resolver": "^5.0.1",
"ember-route-action-helper": "^2.0.3",
"ember-sinon": "^3.0.0",
"ember-source": "~3.5.1",
"ember-svg-jar": "^1.2.1",
Expand Down

0 comments on commit 9833724

Please sign in to comment.