Convert front end paths from /users/ to /u/

This commit is contained in:
Robin Ward
2017-03-28 12:16:58 -04:00
parent 6b976433c9
commit 45a257815a
40 changed files with 129 additions and 84 deletions

View File

@ -12,11 +12,11 @@ acceptance("Password Reset", {
];
};
server.get('/users/confirm-email-token/myvalidtoken.json', () => { //eslint-disable-line
server.get('/u/confirm-email-token/myvalidtoken.json', () => { //eslint-disable-line
return response({success: "OK"});
});
server.put('/users/password-reset/myvalidtoken.json', request => { //eslint-disable-line
server.put('/u/password-reset/myvalidtoken.json', request => { //eslint-disable-line
const body = parsePostData(request.requestBody);
if (body.password === "jonesyAlienSlayer") {
return response({success: false, errors: {password: ["is the name of your cat"]}});

View File

@ -14,7 +14,7 @@ acceptance("Search - Full Page", {
return response({results: [{text: 'monkey', count: 1}]});
});
server.get('/users/search/users', () => { //eslint-disable-line
server.get('/u/search/users', () => { //eslint-disable-line
return response({users: [{username: "admin", name: "admin",
avatar_template: "/images/avatar.png"}]});
});

File diff suppressed because one or more lines are too long

View File

@ -63,17 +63,17 @@ export default function() {
}] });
});
this.get(`/users/eviltrout/emails.json`, () => {
this.get(`/u/eviltrout/emails.json`, () => {
return response({ email: 'eviltrout@example.com' });
});
this.get('/users/eviltrout.json', () => {
const json = fixturesByUrl['/users/eviltrout.json'];
this.get('/u/eviltrout.json', () => {
const json = fixturesByUrl['/u/eviltrout.json'];
json.user.can_edit = loggedIn();
return response(json);
});
this.get('/users/eviltrout/summary.json', () => {
this.get('/u/eviltrout/summary.json', () => {
return response({
user_summary: {
topics: [],
@ -85,13 +85,13 @@ export default function() {
});
});
this.get('/users/eviltrout/invited_count.json', () => {
this.get('/u/eviltrout/invited_count.json', () => {
return response({
"counts": { "pending": 1, "redeemed": 0, "total": 0 }
});
});
this.get('/users/eviltrout/invited.json', () => {
this.get('/u/eviltrout/invited.json', () => {
return response({ "invites": [ {id: 1} ] });
});
@ -113,7 +113,7 @@ export default function() {
return response({});
});
this.put('/users/eviltrout.json', () => response({ user: {} }));
this.put('/u/eviltrout.json', () => response({ user: {} }));
this.get("/t/280.json", () => response(fixturesByUrl['/t/280/1.json']));
this.get("/t/28830.json", () => response(fixturesByUrl['/t/28830/1.json']));
@ -134,7 +134,7 @@ export default function() {
this.delete('/draft.json', success);
this.post('/draft.json', success);
this.get('/users/:username/staff-info.json', () => response({}));
this.get('/u/:username/staff-info.json', () => response({}));
this.get('/post_action_users', () => {
return response({
@ -198,9 +198,9 @@ export default function() {
return response(400, {error: 'invalid login'});
});
this.post('/users/action/send_activation_email', success);
this.post('/u/action/send_activation_email', success);
this.get('/users/hp.json', function() {
this.get('/u/hp.json', function() {
return response({"value":"32faff1b1ef1ac3","challenge":"61a3de0ccf086fb9604b76e884d75801"});
});
@ -208,14 +208,14 @@ export default function() {
return response({"csrf":"mgk906YLagHo2gOgM1ddYjAN4hQolBdJCqlY6jYzAYs="});
});
this.get('/users/check_username', function(request) {
this.get('/u/check_username', function(request) {
if (request.queryParams.username === 'taken') {
return response({available: false, suggestion: 'nottaken'});
}
return response({available: true});
});
this.post('/users', () => response({success: true}));
this.post('/u', () => response({success: true}));
this.get('/login.html', () => [200, {}, 'LOGIN PAGE']);

View File

@ -227,7 +227,7 @@ test("Mentions", function() {
const alwaysTrue = { mentionLookup: (function() { return "user"; }) };
cookedOptions("Hello @sam", alwaysTrue,
"<p>Hello <a class=\"mention\" href=\"/users/sam\">@sam</a></p>",
"<p>Hello <a class=\"mention\" href=\"/u/sam\">@sam</a></p>",
"translates mentions to links");
cooked("[@codinghorror](https://twitter.com/codinghorror)",
@ -303,11 +303,11 @@ test("Mentions", function() {
"handles mentions separated by a slash.");
cookedOptions("@eviltrout", alwaysTrue,
"<p><a class=\"mention\" href=\"/users/eviltrout\">@eviltrout</a></p>",
"<p><a class=\"mention\" href=\"/u/eviltrout\">@eviltrout</a></p>",
"it doesn't onebox mentions");
cookedOptions("<small>a @sam c</small>", alwaysTrue,
"<p><small>a <a class=\"mention\" href=\"/users/sam\">@sam</a> c</small></p>",
"<p><small>a <a class=\"mention\" href=\"/u/sam\">@sam</a> c</small></p>",
"it allows mentions within HTML tags");
});

View File

@ -1,4 +1,4 @@
import DiscourseURL from 'discourse/lib/url';
import { default as DiscourseURL, userPath } from 'discourse/lib/url';
module("lib:url");
@ -25,3 +25,9 @@ test("isInternal on subfolder install", function() {
not(DiscourseURL.isInternal("http://eviltrout.com/tophat"), "a url on the same host but on a different folder is not internal");
ok(DiscourseURL.isInternal("http://eviltrout.com/forum/moustache"), "a url on the same host and on the same folder is internal");
});
test("userPath", assert => {
assert.equal(userPath(), '/u');
assert.equal(userPath('eviltrout'), '/u/eviltrout');
assert.equal(userPath('hp.json'), '/u/hp.json');
});

View File

@ -10,7 +10,7 @@ module("lib:user-search", {
];
};
server.get('/users/search/users', () => { //eslint-disable-line
server.get('/u/search/users', () => { //eslint-disable-line
return response(
{
users: [