Skip to content

Commit

Permalink
Remove accesses to transition parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
backspace committed Dec 10, 2018
1 parent 5aea7e5 commit 40bf52a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
7 changes: 2 additions & 5 deletions app/routes/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ export default Route.extend({
},

redirectToProfile(transition) {
// make this hack the least invasive it can be
let { targetName } = transition;
let { params } = transition;
let { owner } = this.paramsFor('owner');
if (targetName === 'owner.repositories' &&
params.owner &&
params.owner.owner &&
params.owner.owner === 'profile') {
owner === 'profile') {
this.transitionTo('account', {
queryParams: { offset: 0 }
});
Expand Down
2 changes: 1 addition & 1 deletion app/routes/owner/repositories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default TravisRoute.extend({
model({ page }, transition) {
const limit = config.pagination.profileReposPerPage;
const offset = (page - 1) * limit;
const owner = transition.params.owner.owner;
const owner = this.paramsFor('owner').owner;
const type = 'byOwner';
const sort_by = 'default_branch.last_build:desc'; // eslint-disable-line

Expand Down
2 changes: 1 addition & 1 deletion app/routes/owner/running.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default TravisRoute.extend({
model(params, transition) {
let includes =
'?include=user.repositories,organization.repositories,build.commit,repository.active';
let { owner } = transition.params.owner;
let { owner } = this.paramsFor('owner');
return $.ajax({
url: `${config.apiEndpoint}/owner/${owner}${includes}`,
headers: {
Expand Down
4 changes: 2 additions & 2 deletions app/routes/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const SECTION_ROUTE_MAP = {
export default TravisRoute.extend({
accounts: service(),

beforeModel({ params, targetName }) {
const { section, login } = params[targetName] || {};
beforeModel({ targetName }) {
const { section, login } = this.paramsFor('profile') || {};
const isUserAccount = this.accounts.user.login === login;
const root = isUserAccount ? 'account' : 'organization';

Expand Down

0 comments on commit 40bf52a

Please sign in to comment.