Convert server side paths to use /u/

This commit is contained in:
Robin Ward 2017-03-28 14:27:54 -04:00
parent 45a257815a
commit 14410b71fb
38 changed files with 82 additions and 80 deletions

View File

@ -5,6 +5,7 @@ import { popupAjaxError } from 'discourse/lib/ajax-error';
import ApiKey from 'admin/models/api-key';
import Group from 'discourse/models/group';
import TL3Requirements from 'admin/models/tl3-requirements';
import { userPath } from 'discourse/lib/url';
const AdminUser = Discourse.User.extend({
@ -346,7 +347,7 @@ const AdminUser = Discourse.User.extend({
},
sendActivationEmail() {
return ajax('/users/action/send_activation_email', {
return ajax(userPath('action/send_activation_email'), {
type: 'POST',
data: { username: this.get('username') }
}).then(function() {

View File

@ -83,14 +83,14 @@ export default Discourse.Route.extend({
activate() {
this._super();
const user = this.modelFor('user');
this.messageBus.subscribe("/users/" + user.get('username_lower'), function(data) {
this.messageBus.subscribe("/u/" + user.get('username_lower'), function(data) {
user.loadUserAction(data);
});
},
deactivate() {
this._super();
this.messageBus.unsubscribe("/users/" + this.modelFor('user').get('username_lower'));
this.messageBus.unsubscribe("/u/" + this.modelFor('user').get('username_lower'));
// Remove the search context
this.searchService.set('searchContext', null);

View File

@ -348,7 +348,9 @@ class Admin::UsersController < Admin::AdminController
email_token: email_token.token)
end
render json: success_json.merge!(password_url: "#{Discourse.base_url}/users/password-reset/#{email_token.token}")
render json: success_json.merge!(
password_url: "#{Discourse.base_url}#{password_reset_token_path(token: email_token.token)}"
)
end

View File

@ -192,8 +192,8 @@ class ListController < ApplicationController
target_user = fetch_user_from_params
@title = "#{SiteSetting.title} - #{I18n.t("rss_description.user_topics", username: target_user.username)}"
@link = "#{Discourse.base_url}/users/#{target_user.username}/activity/topics"
@atom_link = "#{Discourse.base_url}/users/#{target_user.username}/activity/topics.rss"
@link = "#{Discourse.base_url}/u/#{target_user.username}/activity/topics"
@atom_link = "#{Discourse.base_url}/u/#{target_user.username}/activity/topics.rss"
@description = I18n.t("rss_description.user_topics", username: target_user.username)
@topic_list = TopicQuery.new(nil, order: 'created').send("list_topics_by", target_user)

View File

@ -103,7 +103,7 @@ class PostsController < ApplicationController
@posts = posts
@title = "#{SiteSetting.title} - #{I18n.t("rss_description.user_posts", username: user.username)}"
@link = "#{Discourse.base_url}/users/#{user.username}/activity"
@link = "#{Discourse.base_url}/u/#{user.username}/activity"
@description = I18n.t("rss_description.user_posts", username: user.username)
render 'posts/latest', formats: [:rss]
end

View File

@ -189,7 +189,7 @@ class UsersController < ApplicationController
cookies[:destination_url] = "/my/#{params[:path]}"
redirect_to "/login-preferences"
else
redirect_to(path("/users/#{current_user.username}/#{params[:path]}"))
redirect_to(path("/u/#{current_user.username}/#{params[:path]}"))
end
end

View File

@ -260,7 +260,7 @@ SQL
end
if action.user
MessageBus.publish("/users/#{action.user.username.downcase}", action.id, user_ids: [user_id], group_ids: group_ids)
MessageBus.publish("/u/#{action.user.username.downcase}", action.id, user_ids: [user_id], group_ids: group_ids)
end
action

View File

@ -9,10 +9,10 @@
</td>
<td>
<%- if show_username_on_post(post) %>
<a class="username" href="<%=Discourse.base_url%>/users/<%= post.user.username_lower%>" target="_blank"><%= post.user.username %></a>
<a class="username" href="<%=Discourse.base_url%>/u/<%= post.user.username_lower%>" target="_blank"><%= post.user.username %></a>
<% end %>
<%- if show_name_on_post(post) %>
<a class="user-name" href="<%=Discourse.base_url%>/users/<%= post.user.username_lower%>" target="_blank"><%= post.user.name %></a>
<a class="user-name" href="<%=Discourse.base_url%>/u/<%= post.user.username_lower%>" target="_blank"><%= post.user.name %></a>
<% end %>
<%- if post.user.title.present? %>
<span class='user-title'><%= post.user.title %></span>

View File

@ -16,11 +16,11 @@
<%- end %>
<div class='author'>
<a href='<%= Discourse.base_url %>/users/<%= post.username %>' target="_blank"><img src='<%= post.user.small_avatar_url %>' alt=''></a>
<a href='<%= Discourse.base_url %>/u/<%= post.username %>' target="_blank"><img src='<%= post.user.small_avatar_url %>' alt=''></a>
</div>
<div class='cooked'>
<h3 class='username'>
<a href='<%= Discourse.base_url %>/users/<%= post.username %>' target="_blank" class='<% if post.user.staff? %>staff<% end %><% if post.user.new_user? %>new-user<% end %>'><%= post.user.username %></a>
<a href='<%= Discourse.base_url %>/u/<%= post.username %>' target="_blank" class='<% if post.user.staff? %>staff<% end %><% if post.user.new_user? %>new-user<% end %>'><%= post.user.username %></a>
<%- if post.user.title.present? %>
<span class='title'><%= post.user.title %></span>
<%- end %>

View File

@ -20,7 +20,7 @@
<category><%= topic.category.name %></category>
<description><![CDATA[
<% if username.present? %>
<p><%= t('author_wrote', author: link_to("@#{username}", "#{Discourse.base_url}/users/#{topic.user.username_lower}")).html_safe %></p>
<p><%= t('author_wrote', author: link_to("@#{username}", "#{Discourse.base_url}/u/#{topic.user.username_lower}")).html_safe %></p>
<% end %>
<blockquote>
<%= topic.posts.first.cooked.html_safe %>

View File

@ -10,6 +10,7 @@ Disallow: /auth/github/callback
Disallow: /auth/cas/callback
Disallow: /assets/browser-update*.js
Disallow: /users/
Disallow: /u/
Disallow: /badges/
Disallow: /search
Disallow: /search/

View File

@ -46,7 +46,7 @@
<% if (u = post.user) %>
<div class='creator'>
<span>
<a href='<%= Discourse.base_uri %>/users/<%= u.username %>'><b itemprop='author'><%= u.username %></b></a>
<a href='<%= Discourse.base_uri %>/u/<%= u.username %>'><b itemprop='author'><%= u.username %></b></a>
<%= "(#{u.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names? && !u.name.blank?) %>
<time datetime='<%= post.created_at.to_formatted_s(:iso8601) %>' itemprop='datePublished'>
<%= post.created_at %>

View File

@ -56,7 +56,7 @@
<div>
<img style="float: left; width: 20px; padding-right: 5px;" src="<%= post.user.small_avatar_url %>" title="<%= post.user.username%>">
<p style="font-size: 15px; color: #888">
<a href='<%= "#{Discourse.base_url}/users/#{post.user.username}" %>'>
<a href='<%= "#{Discourse.base_url}/u/#{post.user.username}" %>'>
<%- if show_username_on_post(post) %>
<%= post.user.username %>
<% end %>

View File

@ -1519,7 +1519,7 @@ en:
"2_8": 'You will receive notifications because you are tracking this category.'
"2_4": 'You will receive notifications because you posted a reply to this topic.'
"2_2": 'You will receive notifications because you are tracking this topic.'
"2": 'You will receive notifications because you <a href="/users/{{username}}/preferences">read this topic</a>.'
"2": 'You will receive notifications because you <a href="/u/{{username}}/preferences">read this topic</a>.'
"1_2": 'You will be notified if someone mentions your @name or replies to you.'
"1": 'You will be notified if someone mentions your @name or replies to you.'
"0_7": 'You are ignoring all notifications in this category.'

View File

@ -138,7 +138,7 @@ en:
invite:
not_found: "Your invite token is invalid. Please contact the site's administrator."
user_exists: "There's no need to invite <b>%{email}</b>, they <a href='/users/%{username}/summary'>already have an account!</a>"
user_exists: "There's no need to invite <b>%{email}</b>, they <a href='/u/%{username}/summary'>already have an account!</a>"
bulk_invite:
file_should_be_csv: "The uploaded file should be of csv format."
@ -329,7 +329,7 @@ en:
Have you considered replying to *other* people in the discussion, too? A great discussion involves many voices and perspectives.
If youd like to continue your conversation with this particular user at length, [send them a personal message](/users/%{reply_username}).
If youd like to continue your conversation with this particular user at length, [send them a personal message](/u/%{reply_username}).
too_many_replies: |
### You have reached the reply limit for this topic
@ -398,7 +398,7 @@ en:
taken: is already in use by another emoji
user_profile:
no_info_me: "<div class='missing-profile'>the About Me field of your profile is currently blank, <a href='/users/%{username_lower}/preferences/about-me'>would you like to fill it out?</a></div>"
no_info_me: "<div class='missing-profile'>the About Me field of your profile is currently blank, <a href='/u/%{username_lower}/preferences/about-me'>would you like to fill it out?</a></div>"
no_info_other: "<div class='missing-profile'>%{name} hasn't entered anything in the About Me field of their profile yet</div>"
vip_category_name: "Lounge"
@ -1770,7 +1770,7 @@ en:
Thanks for accepting your invitation to %{site_name} -- welcome!
Click this link to choose a password now:
%{base_url}/users/password-reset/%{email_token}
%{base_url}/u/password-reset/%{email_token}
(If the link above has expired, choose "I forgot my password" when logging in with your email address.)
@ -2552,7 +2552,7 @@ en:
If it was not you, you can safely ignore this email.
Click the following link to choose a new password:
%{base_url}/users/password-reset/%{email_token}
%{base_url}/u/password-reset/%{email_token}
set_password:
title: "Set Password"
@ -2563,7 +2563,7 @@ en:
If you did not make this request, you can safely ignore this email.
Click the following link to choose a password:
%{base_url}/users/password-reset/%{email_token}
%{base_url}/u/password-reset/%{email_token}
admin_login:
title: "Admin Login"
@ -2574,7 +2574,7 @@ en:
If you did not make this request, you can safely ignore this email.
Click the following link to login:
%{base_url}/users/admin-login/%{email_token}
%{base_url}/u/admin-login/%{email_token}
account_created:
title: "Account Created"
@ -2583,7 +2583,7 @@ en:
A new account was created for you at %{site_name}
Click the following link to choose a password for your new account:
%{base_url}/users/password-reset/%{email_token}
%{base_url}/u/password-reset/%{email_token}
confirm_new_email:
title: "Confirm New Email"
@ -2591,7 +2591,7 @@ en:
text_body_template: |
Confirm your new email address for %{site_name} by clicking on the following link:
%{base_url}/users/authorize-email/%{email_token}
%{base_url}/u/authorize-email/%{email_token}
confirm_old_email:
title: "Confirm Old Email"
@ -2603,7 +2603,7 @@ en:
Confirm your current email address for %{site_name} by clicking on the following link:
%{base_url}/users/authorize-email/%{email_token}
%{base_url}/u/authorize-email/%{email_token}
notify_old_email:
title: "Notify Old Email"
@ -2626,7 +2626,7 @@ en:
A staff member approved your account on %{site_name}.
Click the following link to confirm and activate your new account:
%{base_url}/users/activate-account/%{email_token}
%{base_url}/u/activate-account/%{email_token}
If the above link is not clickable, try copying and pasting it into the address bar of your web browser.
@ -2645,7 +2645,7 @@ en:
Welcome to %{site_name}!
Click the following link to confirm and activate your new account:
%{base_url}/users/activate-account/%{email_token}
%{base_url}/u/activate-account/%{email_token}
If the above link is not clickable, try copying and pasting it into the address bar of your web browser.

View File

@ -315,7 +315,7 @@ Discourse::Application.routes.draw do
post "u/read-faq" => "users#read_faq"
get "u/search/users" => "users#search_users"
get "u/account-created/" => "users#account_created"
get "u/password-reset/:token" => "users#password_reset"
get "u/password-reset/:token" => "users#password_reset", as: 'password_reset_token'
get "u/confirm-email-token/:token" => "users#confirm_email_token", constraints: { format: 'json' }
put "u/password-reset/:token" => "users#password_reset"
get "u/activate-account/:token" => "users#activate_account"

View File

@ -76,7 +76,7 @@ class ComposerMessagesFinder
{
id: 'avatar',
templateName: 'education',
body: PrettyText.cook(I18n.t('education.avatar', profile_path: "/users/#{@user.username_lower}"))
body: PrettyText.cook(I18n.t('education.avatar', profile_path: "/u/#{@user.username_lower}"))
}
end

View File

@ -60,7 +60,7 @@ class SystemMessage
{
site_name: SiteSetting.title,
username: @recipient.username,
user_preferences_url: "#{Discourse.base_url}/users/#{@recipient.username_lower}/preferences",
user_preferences_url: "#{Discourse.base_url}/u/#{@recipient.username_lower}/preferences",
new_user_tips: I18n.t('system_messages.usage_tips.text_body_template', base_url: Discourse.base_url),
site_password: "",
base_url: Discourse.base_url,

View File

@ -6,7 +6,7 @@ task 'integration:create_fixtures' => :environment do
fixtures = {
discovery: ["/latest.json", "/categories.json", "/c/bug/l/latest.json"],
topic: ["/t/280.json"],
user: ["/users/eviltrout.json",
user: ["/u/eviltrout.json",
"/user_actions.json",
"/topics/created-by/eviltrout.json"],
static: ["/faq", '/tos', '/privacy'],

View File

@ -194,7 +194,7 @@ begin
["categories", "/categories"],
["home", "/"],
["topic", "/t/oh-how-i-wish-i-could-shut-up-like-a-tunnel-for-so/69"]
# ["user", "/users/admin1/activity"],
# ["user", "/u/admin1/activity"],
]
tests = tests.map{|k,url| ["#{k}_admin", "#{url}#{append}"]} + tests

View File

@ -98,8 +98,6 @@ EOM
def import_users
puts '', "creating users"
username = nil
total_count = mysql_query("SELECT count(*) count FROM #{TABLE_PREFIX}userdata WHERE last_login > '#{IMPORT_AFTER}';").first['count']
batches(BATCH_SIZE) do |offset|
@ -404,7 +402,7 @@ EOM
User.find_each do |u|
ucf = u.custom_fields
if ucf && ucf["import_id"] && ucf["import_username"]
Permalink.create( url: "#{BASE}/user-id-#{ucf['import_id']}.html", external_url: "/users/#{u.username}" ) rescue nil
Permalink.create( url: "#{BASE}/user-id-#{ucf['import_id']}.html", external_url: "/u/#{u.username}" ) rescue nil
print '.'
end
end

View File

@ -121,8 +121,8 @@ describe PostCreator do
# 2 for topic, one to notify of new topic another for tracking state
expect(messages.map{|m| m.channel}.sort).to eq([ "/new",
"/users/#{admin.username}",
"/users/#{admin.username}",
"/u/#{admin.username}",
"/u/#{admin.username}",
"/unread/#{admin.id}",
"/unread/#{admin.id}",
"/latest",
@ -153,7 +153,7 @@ describe PostCreator do
read = messages.find{|m| m.channel == "/unread/#{p.user_id}"}
expect(read).not_to eq(nil)
user_action = messages.find{|m| m.channel == "/users/#{p.user.username}"}
user_action = messages.find{|m| m.channel == "/u/#{p.user.username}"}
expect(user_action).not_to eq(nil)
expect(messages.length).to eq(5)

View File

@ -323,9 +323,9 @@ HTML
end
it "adds base url to relative links" do
html = "<p><a class=\"mention\" href=\"/users/wiseguy\">@wiseguy</a>, <a class=\"mention\" href=\"/users/trollol\">@trollol</a> what do you guys think? </p>"
html = "<p><a class=\"mention\" href=\"/u/wiseguy\">@wiseguy</a>, <a class=\"mention\" href=\"/u/trollol\">@trollol</a> what do you guys think? </p>"
output = described_class.format_for_email(html, post)
expect(output).to eq("<p><a class=\"mention\" href=\"#{base_url}/users/wiseguy\">@wiseguy</a>, <a class=\"mention\" href=\"#{base_url}/users/trollol\">@trollol</a> what do you guys think? </p>")
expect(output).to eq("<p><a class=\"mention\" href=\"#{base_url}/u/wiseguy\">@wiseguy</a>, <a class=\"mention\" href=\"#{base_url}/u/trollol\">@trollol</a> what do you guys think? </p>")
end
it "doesn't change external absolute links" do

View File

@ -6,7 +6,7 @@ RSpec.describe "Users" do
describe "viewing a user" do
it "should be able to view a user" do
get "/users/#{user.username}"
get "/u/#{user.username}"
expect(response).to be_success
expect(response.body).to include(user.username)
@ -18,7 +18,7 @@ RSpec.describe "Users" do
end
it "should be able to view a user" do
get "/users/#{user.username}"
get "/u/#{user.username}"
expect(response).to be_success
expect(response.body).to include(user.username)
@ -32,7 +32,7 @@ RSpec.describe "Users" do
end
it "should be able to update a user" do
put "/users/#{user.username}.json", { name: 'test.test' }
put "/u/#{user.username}.json", { name: 'test.test' }
expect(response).to be_success
expect(user.reload.name).to eq('test.test')
@ -44,7 +44,7 @@ RSpec.describe "Users" do
end
it "should be able to update a user" do
put "/users/#{user.username}.json", { name: 'testing123' }
put "/u/#{user.username}.json", { name: 'testing123' }
expect(response).to be_success
expect(user.reload.name).to eq('testing123')

View File

@ -137,7 +137,7 @@ http://b.com/#{'a'*500}
end
context "link to a user on discourse" do
let(:post) { topic.posts.create(user: user, raw: "<a href='/users/#{user.username_lower}'>user</a>") }
let(:post) { topic.posts.create(user: user, raw: "<a href='/u/#{user.username_lower}'>user</a>") }
before do
TopicLink.extract_from(post)
end

View File

@ -30,7 +30,7 @@ acceptance("Password Reset", {
test("Password Reset Page", () => {
PreloadStore.store('password_reset', {is_developer: false});
visit("/users/password-reset/myvalidtoken");
visit("/u/password-reset/myvalidtoken");
andThen(() => {
ok(exists(".password-reset input"), "shows the input");
});

View File

@ -35,7 +35,7 @@ acceptance("Plugin Outlet - Connector Class", {
});
test("Renders a template into the outlet", assert => {
visit("/users/eviltrout");
visit("/u/eviltrout");
andThen(() => {
assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names');
assert.ok(!find('.user-profile-primary-outlet.dont-render').length, "doesn't render");

View File

@ -19,7 +19,7 @@ acceptance("Plugin Outlet - Multi Template", {
});
test("Renders a template into the outlet", assert => {
visit("/users/eviltrout");
visit("/u/eviltrout");
andThen(() => {
assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names');
assert.ok(find('.user-profile-primary-outlet.goodbye').length === 1, 'it has class names');

View File

@ -14,7 +14,7 @@ acceptance("Plugin Outlet - Single Template", {
});
test("Renders a template into the outlet", assert => {
visit("/users/eviltrout");
visit("/u/eviltrout");
andThen(() => {
assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names');
assert.equal(find('.hello-username').text(), 'eviltrout', 'it renders into the outlet');

View File

@ -2,11 +2,11 @@ import { acceptance } from "helpers/qunit-helpers";
acceptance("User Preferences", { loggedIn: true });
test("update some fields", () => {
visit("/users/eviltrout/preferences");
visit("/u/eviltrout/preferences");
andThen(() => {
ok($('body.user-preferences-page').length, "has the body class");
equal(currentURL(), '/users/eviltrout/preferences', "it doesn't redirect");
equal(currentURL(), '/u/eviltrout/preferences', "it doesn't redirect");
ok(exists('.user-preferences'), 'it shows the preferences');
});
@ -20,21 +20,21 @@ test("update some fields", () => {
});
test("username", () => {
visit("/users/eviltrout/preferences/username");
visit("/u/eviltrout/preferences/username");
andThen(() => {
ok(exists("#change_username"), "it has the input element");
});
});
test("about me", () => {
visit("/users/eviltrout/preferences/about-me");
visit("/u/eviltrout/preferences/about-me");
andThen(() => {
ok(exists(".raw-bio"), "it has the input element");
});
});
test("email", () => {
visit("/users/eviltrout/preferences/email");
visit("/u/eviltrout/preferences/email");
andThen(() => {
ok(exists("#change-email"), "it has the input element");
});

View File

@ -40,7 +40,7 @@ test("search scope checkbox", () => {
});
click('#search-button');
visit("/users/eviltrout");
visit("/u/eviltrout");
click('#search-button');
andThen(() => {
ok(exists('.search-context input:checked'), 'scope to user checkbox is checked');

View File

@ -16,7 +16,7 @@ function hasTopicList() {
}
test("Root URL", () => {
visit("/users/eviltrout");
visit("/u/eviltrout");
andThen(() => {
ok($('body.user-summary-page').length, "has the body class");
equal(currentPath(), 'user.summary', "it defaults to summary");
@ -24,21 +24,21 @@ test("Root URL", () => {
});
test("Filters", () => {
visit("/users/eviltrout/activity");
visit("/u/eviltrout/activity");
andThen(() => {
ok($('body.user-activity-page').length, "has the body class");
});
hasStream();
visit("/users/eviltrout/activity/topics");
visit("/u/eviltrout/activity/topics");
hasTopicList();
visit("/users/eviltrout/activity/replies");
visit("/u/eviltrout/activity/replies");
hasStream();
});
test("Badges", () => {
visit("/users/eviltrout/badges");
visit("/u/eviltrout/badges");
andThen(() => {
ok($('body.user-badges-page').length, "has the body class");
ok(exists(".user-badges-list .badge-card"), "shows a badge");
@ -46,7 +46,7 @@ test("Badges", () => {
});
test("Restricted Routes", () => {
visit("/users/eviltrout/preferences");
visit("/u/eviltrout/preferences");
andThen(() => {
equal(currentURL(), '/u/eviltrout/activity', "it redirects from preferences");

View File

@ -3,28 +3,28 @@ import { acceptance } from "helpers/qunit-helpers";
acceptance("User", {loggedIn: true});
test("Invites", () => {
visit("/users/eviltrout/invited/pending");
visit("/u/eviltrout/invited/pending");
andThen(() => {
ok($('body.user-invites-page').length, "has the body class");
});
});
test("Messages", () => {
visit("/users/eviltrout/messages");
visit("/u/eviltrout/messages");
andThen(() => {
ok($('body.user-messages-page').length, "has the body class");
});
});
test("Notifications", () => {
visit("/users/eviltrout/notifications");
visit("/u/eviltrout/notifications");
andThen(() => {
ok($('body.user-notifications-page').length, "has the body class");
});
});
test("Root URL - Viewing Self", () => {
visit("/users/eviltrout");
visit("/u/eviltrout");
andThen(() => {
ok($('body.user-activity-page').length, "has the body class");
equal(currentPath(), 'user.userActivity.index', "it defaults to activity");

View File

@ -440,7 +440,7 @@ export default {
},
{
"id":94544,
"cooked":"<p><a class=\"mention\" href=\"/users/techapj\">@techapj</a> fixed this for 1.2.</p>",
"cooked":"<p><a class=\"mention\" href=\"/u/techapj\">@techapj</a> fixed this for 1.2.</p>",
"created_at":"2015-01-23T05:49:35.881Z",
"title":"After sign-in, I'm not redirected to the conversation",
"url":"/t/after-sign-in-im-not-redirected-to-the-conversation/17753/8",
@ -540,7 +540,7 @@ export default {
},
{
"id":94542,
"cooked":"<p>Hmm that looks like a bug, <a class=\"mention\" href=\"/users/techapj\">@techapj</a> can you have a look?</p>",
"cooked":"<p>Hmm that looks like a bug, <a class=\"mention\" href=\"/u/techapj\">@techapj</a> can you have a look?</p>",
"created_at":"2015-01-23T05:43:55.602Z",
"title":"RSS is not valid",
"url":"/t/rss-is-not-valid/24338/2",
@ -590,7 +590,7 @@ export default {
},
{
"id":94522,
"cooked":"<p>Oh I see. <a class=\"mention\" href=\"/users/zogstrip\">@zogstrip</a> can you have a look?</p>",
"cooked":"<p>Oh I see. <a class=\"mention\" href=\"/u/zogstrip\">@zogstrip</a> can you have a look?</p>",
"created_at":"2015-01-23T03:00:20.485Z",
"title":"Pasted image upload size error",
"url":"/t/pasted-image-upload-size-error/24320/4",
@ -640,7 +640,7 @@ export default {
},
{
"id":94521,
"cooked":"<p><a class=\"mention\" href=\"/users/techapj\">@techapj</a> fixed this for 1.2.</p>",
"cooked":"<p><a class=\"mention\" href=\"/u/techapj\">@techapj</a> fixed this for 1.2.</p>",
"created_at":"2015-01-23T02:58:27.451Z",
"title":"The end of Clown Vomit, or, simplified category styles",
"url":"/t/the-end-of-clown-vomit-or-simplified-category-styles/24249/57",

View File

@ -92,13 +92,13 @@ test("url", function() {
var t, testClass;
testClass = Em.Object.extend({
userUrl: url('username', "/users/%@")
userUrl: url('username', "/u/%@")
});
t = testClass.create({ username: 'eviltrout' });
equal(t.get('userUrl'), "/users/eviltrout", "it supports urls without a prefix");
equal(t.get('userUrl'), "/u/eviltrout", "it supports urls without a prefix");
Discourse.BaseUri = "/prefixed";
t = testClass.create({ username: 'eviltrout' });
equal(t.get('userUrl'), "/prefixed/users/eviltrout", "it supports urls with a prefix");
equal(t.get('userUrl'), "/prefixed/u/eviltrout", "it supports urls with a prefix");
});

View File

@ -3,5 +3,5 @@ module("lib:discourse");
test("getURL on subfolder install", function() {
Discourse.BaseUri = "/forum";
equal(Discourse.getURL("/"), "/forum/", "root url has subfolder");
equal(Discourse.getURL("/users/neil"), "/forum/users/neil", "relative url has subfolder");
});
equal(Discourse.getURL("/u/neil"), "/forum/u/neil", "relative url has subfolder");
});

View File

@ -130,8 +130,8 @@ test("Links", function() {
"<p>Here's a tweet:<br/><a href=\"https://twitter.com/evil_trout/status/345954894420787200\" class=\"onebox\" target=\"_blank\">https://twitter.com/evil_trout/status/345954894420787200</a></p>",
"It doesn't strip the new line.");
cooked("1. View @eviltrout's profile here: http://meta.discourse.org/users/eviltrout/activity<br/>next line.",
"<ol><li>View <span class=\"mention\">@eviltrout</span>'s profile here: <a href=\"http://meta.discourse.org/users/eviltrout/activity\">http://meta.discourse.org/users/eviltrout/activity</a><br>next line.</li></ol>",
cooked("1. View @eviltrout's profile here: http://meta.discourse.org/u/eviltrout/activity<br/>next line.",
"<ol><li>View <span class=\"mention\">@eviltrout</span>'s profile here: <a href=\"http://meta.discourse.org/u/eviltrout/activity\">http://meta.discourse.org/u/eviltrout/activity</a><br>next line.</li></ol>",
"allows autolinking within a list without inserting a paragraph.");
cooked("[3]: http://eviltrout.com", "", "It doesn't autolink markdown link references");

View File

@ -7,7 +7,7 @@ widgetTest('basic rendering', {
setup() {
this.set('args', {
username: 'eviltrout',
usernameUrl: '/users/eviltrout',
usernameUrl: '/u/eviltrout',
name: 'Robin Ward',
user_title: 'Trout Master' });
},
@ -26,7 +26,7 @@ widgetTest('extra classes and glyphs', {
setup() {
this.set('args', {
username: 'eviltrout',
usernameUrl: '/users/eviltrout',
usernameUrl: '/u/eviltrout',
staff: true,
admin: true,
moderator: true,