Skip to content

Commit cf7c27d

Browse files
committed
Rename /me to /settings
Only `me.index` is migrated to `settings.index`, the other nested `me` routes still keep their old paths for now.
1 parent b06e521 commit cf7c27d

File tree

10 files changed

+58
-47
lines changed

10 files changed

+58
-47
lines changed

app/components/header.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
<dd.Menu local-class="current-user-links" as |menu|>
5252
<menu.Item><LinkTo @route="dashboard">Dashboard</LinkTo></menu.Item>
53-
<menu.Item><LinkTo @route="me">Account Settings</LinkTo></menu.Item>
53+
<menu.Item><LinkTo @route="settings">Account Settings</LinkTo></menu.Item>
5454
<menu.Item><LinkTo @route="me.pending-invites">Owner Invites</LinkTo></menu.Item>
5555
<menu.Item local-class="menu-item-with-separator">
5656
<button
@@ -95,7 +95,7 @@
9595
<menu.Item><LinkTo @route="crates">Browse All Crates</LinkTo></menu.Item>
9696
{{#if this.session.currentUser}}
9797
<menu.Item><LinkTo @route="dashboard">Dashboard</LinkTo></menu.Item>
98-
<menu.Item><LinkTo @route="me" data-test-me-link>Account Settings</LinkTo></menu.Item>
98+
<menu.Item><LinkTo @route="settings" data-test-me-link>Account Settings</LinkTo></menu.Item>
9999
<menu.Item><LinkTo @route="me.pending-invites">Owner Invites</LinkTo></menu.Item>
100100
<menu.Item local-class="menu-item-with-separator">
101101
<button

app/controllers/me/index.js renamed to app/controllers/settings/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { alias } from 'macro-decorators';
66

77
import ajax from '../../utils/ajax';
88

9-
export default class MeIndexController extends Controller {
9+
export default class SettingsController extends Controller {
1010
isResetting = false;
1111

1212
@alias('model.ownedCrates') ownedCrates;

app/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Router.map(function () {
3131
this.route('following');
3232
this.route('pending-invites');
3333
});
34+
this.route('settings');
3435
this.route('user', { path: '/users/:user_id' });
3536
this.route('install');
3637
this.route('search');

app/routes/me/index.js

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
1+
import Route from '@ember/routing/route';
12
import { inject as service } from '@ember/service';
23

3-
import AuthenticatedRoute from '../-authenticated-route';
4+
export default class MeIndexRoute extends Route {
5+
@service router;
46

5-
export default class MeIndexRoute extends AuthenticatedRoute {
6-
@service store;
7-
8-
async model() {
9-
let { ownedCrates, currentUser: user } = this.session;
10-
11-
if (!ownedCrates) {
12-
await this.session.fetchUser();
13-
({ ownedCrates } = this.session);
14-
}
15-
16-
let apiTokens = await this.store.findAll('api-token');
17-
18-
return { user, ownedCrates, api_tokens: apiTokens.toArray() };
19-
}
20-
21-
setupController(controller) {
22-
super.setupController(...arguments);
23-
24-
controller.setProperties({
25-
emailNotificationsSuccess: false,
26-
emailNotificationsError: false,
27-
});
7+
redirect() {
8+
this.router.replaceWith('settings');
289
}
2910
}

app/routes/settings/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { inject as service } from '@ember/service';
2+
3+
import AuthenticatedRoute from '../-authenticated-route';
4+
5+
export default class SettingsRoute extends AuthenticatedRoute {
6+
@service store;
7+
8+
async model() {
9+
let { ownedCrates, currentUser: user } = this.session;
10+
11+
if (!ownedCrates) {
12+
await this.session.fetchUser();
13+
({ ownedCrates } = this.session);
14+
}
15+
16+
let apiTokens = await this.store.findAll('api-token');
17+
18+
return { user, ownedCrates, api_tokens: apiTokens.toArray() };
19+
}
20+
21+
setupController(controller) {
22+
super.setupController(...arguments);
23+
24+
controller.setProperties({
25+
emailNotificationsSuccess: false,
26+
emailNotificationsError: false,
27+
});
28+
}
29+
}
File renamed without changes.
File renamed without changes.

tests/acceptance/api-token-test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ module('Acceptance | api-tokens', function (hooks) {
3939
test('/me is showing the list of active API tokens', async function (assert) {
4040
prepare(this);
4141

42-
await visit('/me');
43-
assert.equal(currentURL(), '/me');
42+
await visit('/settings');
43+
assert.equal(currentURL(), '/settings');
4444
assert.dom('[data-test-api-token]').exists({ count: 2 });
4545

4646
let [row1, row2] = findAll('[data-test-api-token]');
@@ -66,8 +66,8 @@ module('Acceptance | api-tokens', function (hooks) {
6666
test('API tokens can be revoked', async function (assert) {
6767
prepare(this);
6868

69-
await visit('/me');
70-
assert.equal(currentURL(), '/me');
69+
await visit('/settings');
70+
assert.equal(currentURL(), '/settings');
7171
assert.dom('[data-test-api-token]').exists({ count: 2 });
7272

7373
await click('[data-test-api-token="1"] [data-test-revoke-token-button]');
@@ -85,8 +85,8 @@ module('Acceptance | api-tokens', function (hooks) {
8585
return new Response(500, {}, {});
8686
});
8787

88-
await visit('/me');
89-
assert.equal(currentURL(), '/me');
88+
await visit('/settings');
89+
assert.equal(currentURL(), '/settings');
9090
assert.dom('[data-test-api-token]').exists({ count: 2 });
9191

9292
await click('[data-test-api-token="1"] [data-test-revoke-token-button]');
@@ -99,8 +99,8 @@ module('Acceptance | api-tokens', function (hooks) {
9999
test('new API tokens can be created', async function (assert) {
100100
prepare(this);
101101

102-
await visit('/me');
103-
assert.equal(currentURL(), '/me');
102+
await visit('/settings');
103+
assert.equal(currentURL(), '/settings');
104104
assert.dom('[data-test-api-token]').exists({ count: 2 });
105105
assert.dom('[data-test-focused-input]').doesNotExist();
106106
assert.dom('[data-test-save-token-button]').doesNotExist();

tests/acceptance/email-change-test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ module('Acceptance | Email Change', function (hooks) {
1313

1414
this.authenticateAs(user);
1515

16-
await visit('/me');
17-
assert.equal(currentURL(), '/me');
16+
await visit('/settings');
17+
assert.equal(currentURL(), '/settings');
1818
assert.dom('[data-test-email-input]').exists();
1919
assert.dom('[data-test-email-input] [data-test-no-email]').doesNotExist();
2020
assert.dom('[data-test-email-input] [data-test-email-address]').includesText('old@email.com');
@@ -54,8 +54,8 @@ module('Acceptance | Email Change', function (hooks) {
5454

5555
this.authenticateAs(user);
5656

57-
await visit('/me');
58-
assert.equal(currentURL(), '/me');
57+
await visit('/settings');
58+
assert.equal(currentURL(), '/settings');
5959
assert.dom('[data-test-email-input]').exists();
6060
assert.dom('[data-test-email-input] [data-test-no-email]').exists();
6161
assert.dom('[data-test-email-input] [data-test-email-address]').hasText('');
@@ -91,7 +91,7 @@ module('Acceptance | Email Change', function (hooks) {
9191

9292
this.authenticateAs(user);
9393

94-
await visit('/me');
94+
await visit('/settings');
9595
await click('[data-test-email-input] [data-test-edit-button]');
9696
await fillIn('[data-test-email-input] [data-test-input]', 'new@email.com');
9797
assert.dom('[data-test-email-input] [data-test-invalid-email-warning]').doesNotExist();
@@ -115,7 +115,7 @@ module('Acceptance | Email Change', function (hooks) {
115115

116116
this.server.put('/api/v1/users/:user_id', {}, 500);
117117

118-
await visit('/me');
118+
await visit('/settings');
119119
await click('[data-test-email-input] [data-test-edit-button]');
120120
await fillIn('[data-test-email-input] [data-test-input]', 'new@email.com');
121121

@@ -138,8 +138,8 @@ module('Acceptance | Email Change', function (hooks) {
138138

139139
this.authenticateAs(user);
140140

141-
await visit('/me');
142-
assert.equal(currentURL(), '/me');
141+
await visit('/settings');
142+
assert.equal(currentURL(), '/settings');
143143
assert.dom('[data-test-email-input]').exists();
144144
assert.dom('[data-test-email-input] [data-test-email-address]').includesText('john@doe.com');
145145
assert.dom('[data-test-email-input] [data-test-verified]').doesNotExist();
@@ -158,8 +158,8 @@ module('Acceptance | Email Change', function (hooks) {
158158

159159
this.server.put('/api/v1/users/:user_id/resend', {}, 500);
160160

161-
await visit('/me');
162-
assert.equal(currentURL(), '/me');
161+
await visit('/settings');
162+
assert.equal(currentURL(), '/settings');
163163
assert.dom('[data-test-email-input]').exists();
164164
assert.dom('[data-test-email-input] [data-test-email-address]').includesText('john@doe.com');
165165
assert.dom('[data-test-email-input] [data-test-verified]').doesNotExist();

tests/bugs/2329-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ module('Bug #2329', function (hooks) {
5656
// 6. Use the menu to navigate to "Account Settings".
5757
await click('[data-test-user-menu]');
5858
await click('[data-test-me-link]');
59-
await visit('/me');
60-
assert.equal(currentURL(), '/me');
59+
await visit('/settings');
60+
assert.equal(currentURL(), '/settings');
6161

6262
// 7. Observe that there are no crates listed under "Email Notification Preferences".
6363
// Observe that no request was sent to the /api/v1/me endpoint to obtain this data.

0 commit comments

Comments
 (0)