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

View File

@ -83,14 +83,14 @@ export default Discourse.Route.extend({
activate() { activate() {
this._super(); this._super();
const user = this.modelFor('user'); 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); user.loadUserAction(data);
}); });
}, },
deactivate() { deactivate() {
this._super(); 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 // Remove the search context
this.searchService.set('searchContext', null); this.searchService.set('searchContext', null);

View File

@ -348,7 +348,9 @@ class Admin::UsersController < Admin::AdminController
email_token: email_token.token) email_token: email_token.token)
end 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 end

View File

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

View File

@ -103,7 +103,7 @@ class PostsController < ApplicationController
@posts = posts @posts = posts
@title = "#{SiteSetting.title} - #{I18n.t("rss_description.user_posts", username: user.username)}" @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) @description = I18n.t("rss_description.user_posts", username: user.username)
render 'posts/latest', formats: [:rss] render 'posts/latest', formats: [:rss]
end end

View File

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

View File

@ -260,7 +260,7 @@ SQL
end end
if action.user 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 end
action action

View File

@ -9,10 +9,10 @@
</td> </td>
<td> <td>
<%- if show_username_on_post(post) %> <%- 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 %> <% end %>
<%- if show_name_on_post(post) %> <%- 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 %> <% end %>
<%- if post.user.title.present? %> <%- if post.user.title.present? %>
<span class='user-title'><%= post.user.title %></span> <span class='user-title'><%= post.user.title %></span>

View File

@ -16,11 +16,11 @@
<%- end %> <%- end %>
<div class='author'> <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>
<div class='cooked'> <div class='cooked'>
<h3 class='username'> <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? %> <%- if post.user.title.present? %>
<span class='title'><%= post.user.title %></span> <span class='title'><%= post.user.title %></span>
<%- end %> <%- end %>

View File

@ -20,7 +20,7 @@
<category><%= topic.category.name %></category> <category><%= topic.category.name %></category>
<description><![CDATA[ <description><![CDATA[
<% if username.present? %> <% 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 %> <% end %>
<blockquote> <blockquote>
<%= topic.posts.first.cooked.html_safe %> <%= topic.posts.first.cooked.html_safe %>

View File

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

View File

@ -46,7 +46,7 @@
<% if (u = post.user) %> <% if (u = post.user) %>
<div class='creator'> <div class='creator'>
<span> <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?) %> <%= "(#{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'> <time datetime='<%= post.created_at.to_formatted_s(:iso8601) %>' itemprop='datePublished'>
<%= post.created_at %> <%= post.created_at %>

View File

@ -56,7 +56,7 @@
<div> <div>
<img style="float: left; width: 20px; padding-right: 5px;" src="<%= post.user.small_avatar_url %>" title="<%= post.user.username%>"> <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"> <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) %> <%- if show_username_on_post(post) %>
<%= post.user.username %> <%= post.user.username %>
<% end %> <% end %>

View File

@ -1519,7 +1519,7 @@ en:
"2_8": 'You will receive notifications because you are tracking this category.' "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_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_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_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.' "1": 'You will be notified if someone mentions your @name or replies to you.'
"0_7": 'You are ignoring all notifications in this category.' "0_7": 'You are ignoring all notifications in this category.'

View File

@ -138,7 +138,7 @@ en:
invite: invite:
not_found: "Your invite token is invalid. Please contact the site's administrator." 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: bulk_invite:
file_should_be_csv: "The uploaded file should be of csv format." 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. 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: | too_many_replies: |
### You have reached the reply limit for this topic ### You have reached the reply limit for this topic
@ -398,7 +398,7 @@ en:
taken: is already in use by another emoji taken: is already in use by another emoji
user_profile: 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>" 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" vip_category_name: "Lounge"
@ -1770,7 +1770,7 @@ en:
Thanks for accepting your invitation to %{site_name} -- welcome! Thanks for accepting your invitation to %{site_name} -- welcome!
Click this link to choose a password now: 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.) (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. If it was not you, you can safely ignore this email.
Click the following link to choose a new password: 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: set_password:
title: "Set Password" title: "Set Password"
@ -2563,7 +2563,7 @@ en:
If you did not make this request, you can safely ignore this email. If you did not make this request, you can safely ignore this email.
Click the following link to choose a password: Click the following link to choose a password:
%{base_url}/users/password-reset/%{email_token} %{base_url}/u/password-reset/%{email_token}
admin_login: admin_login:
title: "Admin Login" title: "Admin Login"
@ -2574,7 +2574,7 @@ en:
If you did not make this request, you can safely ignore this email. If you did not make this request, you can safely ignore this email.
Click the following link to login: Click the following link to login:
%{base_url}/users/admin-login/%{email_token} %{base_url}/u/admin-login/%{email_token}
account_created: account_created:
title: "Account Created" title: "Account Created"
@ -2583,7 +2583,7 @@ en:
A new account was created for you at %{site_name} A new account was created for you at %{site_name}
Click the following link to choose a password for your new account: 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: confirm_new_email:
title: "Confirm New Email" title: "Confirm New Email"
@ -2591,7 +2591,7 @@ en:
text_body_template: | text_body_template: |
Confirm your new email address for %{site_name} by clicking on the following link: 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: confirm_old_email:
title: "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: 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: notify_old_email:
title: "Notify Old Email" title: "Notify Old Email"
@ -2626,7 +2626,7 @@ en:
A staff member approved your account on %{site_name}. A staff member approved your account on %{site_name}.
Click the following link to confirm and activate your new account: 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. 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}! Welcome to %{site_name}!
Click the following link to confirm and activate your new account: 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. 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" post "u/read-faq" => "users#read_faq"
get "u/search/users" => "users#search_users" get "u/search/users" => "users#search_users"
get "u/account-created/" => "users#account_created" 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' } get "u/confirm-email-token/:token" => "users#confirm_email_token", constraints: { format: 'json' }
put "u/password-reset/:token" => "users#password_reset" put "u/password-reset/:token" => "users#password_reset"
get "u/activate-account/:token" => "users#activate_account" get "u/activate-account/:token" => "users#activate_account"

View File

@ -76,7 +76,7 @@ class ComposerMessagesFinder
{ {
id: 'avatar', id: 'avatar',
templateName: 'education', 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 end

View File

@ -60,7 +60,7 @@ class SystemMessage
{ {
site_name: SiteSetting.title, site_name: SiteSetting.title,
username: @recipient.username, 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), new_user_tips: I18n.t('system_messages.usage_tips.text_body_template', base_url: Discourse.base_url),
site_password: "", site_password: "",
base_url: Discourse.base_url, base_url: Discourse.base_url,

View File

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

View File

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

View File

@ -98,8 +98,6 @@ EOM
def import_users def import_users
puts '', "creating users" puts '', "creating users"
username = nil
total_count = mysql_query("SELECT count(*) count FROM #{TABLE_PREFIX}userdata WHERE last_login > '#{IMPORT_AFTER}';").first['count'] total_count = mysql_query("SELECT count(*) count FROM #{TABLE_PREFIX}userdata WHERE last_login > '#{IMPORT_AFTER}';").first['count']
batches(BATCH_SIZE) do |offset| batches(BATCH_SIZE) do |offset|
@ -404,7 +402,7 @@ EOM
User.find_each do |u| User.find_each do |u|
ucf = u.custom_fields ucf = u.custom_fields
if ucf && ucf["import_id"] && ucf["import_username"] 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 '.' print '.'
end end
end end

View File

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

View File

@ -323,9 +323,9 @@ HTML
end end
it "adds base url to relative links" do 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) 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 end
it "doesn't change external absolute links" do it "doesn't change external absolute links" do

View File

@ -6,7 +6,7 @@ RSpec.describe "Users" do
describe "viewing a user" do describe "viewing a user" do
it "should be able to view 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).to be_success
expect(response.body).to include(user.username) expect(response.body).to include(user.username)
@ -18,7 +18,7 @@ RSpec.describe "Users" do
end end
it "should be able to view 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).to be_success
expect(response.body).to include(user.username) expect(response.body).to include(user.username)
@ -32,7 +32,7 @@ RSpec.describe "Users" do
end end
it "should be able to update a user" do 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(response).to be_success
expect(user.reload.name).to eq('test.test') expect(user.reload.name).to eq('test.test')
@ -44,7 +44,7 @@ RSpec.describe "Users" do
end end
it "should be able to update a user" do 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(response).to be_success
expect(user.reload.name).to eq('testing123') expect(user.reload.name).to eq('testing123')

View File

@ -137,7 +137,7 @@ http://b.com/#{'a'*500}
end end
context "link to a user on discourse" do 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 before do
TopicLink.extract_from(post) TopicLink.extract_from(post)
end end

View File

@ -30,7 +30,7 @@ acceptance("Password Reset", {
test("Password Reset Page", () => { test("Password Reset Page", () => {
PreloadStore.store('password_reset', {is_developer: false}); PreloadStore.store('password_reset', {is_developer: false});
visit("/users/password-reset/myvalidtoken"); visit("/u/password-reset/myvalidtoken");
andThen(() => { andThen(() => {
ok(exists(".password-reset input"), "shows the input"); 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 => { test("Renders a template into the outlet", assert => {
visit("/users/eviltrout"); visit("/u/eviltrout");
andThen(() => { andThen(() => {
assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names'); 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"); 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 => { test("Renders a template into the outlet", assert => {
visit("/users/eviltrout"); visit("/u/eviltrout");
andThen(() => { andThen(() => {
assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names'); 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'); 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 => { test("Renders a template into the outlet", assert => {
visit("/users/eviltrout"); visit("/u/eviltrout");
andThen(() => { andThen(() => {
assert.ok(find('.user-profile-primary-outlet.hello').length === 1, 'it has class names'); 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'); 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 }); acceptance("User Preferences", { loggedIn: true });
test("update some fields", () => { test("update some fields", () => {
visit("/users/eviltrout/preferences"); visit("/u/eviltrout/preferences");
andThen(() => { andThen(() => {
ok($('body.user-preferences-page').length, "has the body class"); 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'); ok(exists('.user-preferences'), 'it shows the preferences');
}); });
@ -20,21 +20,21 @@ test("update some fields", () => {
}); });
test("username", () => { test("username", () => {
visit("/users/eviltrout/preferences/username"); visit("/u/eviltrout/preferences/username");
andThen(() => { andThen(() => {
ok(exists("#change_username"), "it has the input element"); ok(exists("#change_username"), "it has the input element");
}); });
}); });
test("about me", () => { test("about me", () => {
visit("/users/eviltrout/preferences/about-me"); visit("/u/eviltrout/preferences/about-me");
andThen(() => { andThen(() => {
ok(exists(".raw-bio"), "it has the input element"); ok(exists(".raw-bio"), "it has the input element");
}); });
}); });
test("email", () => { test("email", () => {
visit("/users/eviltrout/preferences/email"); visit("/u/eviltrout/preferences/email");
andThen(() => { andThen(() => {
ok(exists("#change-email"), "it has the input element"); ok(exists("#change-email"), "it has the input element");
}); });

View File

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

View File

@ -16,7 +16,7 @@ function hasTopicList() {
} }
test("Root URL", () => { test("Root URL", () => {
visit("/users/eviltrout"); visit("/u/eviltrout");
andThen(() => { andThen(() => {
ok($('body.user-summary-page').length, "has the body class"); ok($('body.user-summary-page').length, "has the body class");
equal(currentPath(), 'user.summary', "it defaults to summary"); equal(currentPath(), 'user.summary', "it defaults to summary");
@ -24,21 +24,21 @@ test("Root URL", () => {
}); });
test("Filters", () => { test("Filters", () => {
visit("/users/eviltrout/activity"); visit("/u/eviltrout/activity");
andThen(() => { andThen(() => {
ok($('body.user-activity-page').length, "has the body class"); ok($('body.user-activity-page').length, "has the body class");
}); });
hasStream(); hasStream();
visit("/users/eviltrout/activity/topics"); visit("/u/eviltrout/activity/topics");
hasTopicList(); hasTopicList();
visit("/users/eviltrout/activity/replies"); visit("/u/eviltrout/activity/replies");
hasStream(); hasStream();
}); });
test("Badges", () => { test("Badges", () => {
visit("/users/eviltrout/badges"); visit("/u/eviltrout/badges");
andThen(() => { andThen(() => {
ok($('body.user-badges-page').length, "has the body class"); ok($('body.user-badges-page').length, "has the body class");
ok(exists(".user-badges-list .badge-card"), "shows a badge"); ok(exists(".user-badges-list .badge-card"), "shows a badge");
@ -46,7 +46,7 @@ test("Badges", () => {
}); });
test("Restricted Routes", () => { test("Restricted Routes", () => {
visit("/users/eviltrout/preferences"); visit("/u/eviltrout/preferences");
andThen(() => { andThen(() => {
equal(currentURL(), '/u/eviltrout/activity', "it redirects from preferences"); 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}); acceptance("User", {loggedIn: true});
test("Invites", () => { test("Invites", () => {
visit("/users/eviltrout/invited/pending"); visit("/u/eviltrout/invited/pending");
andThen(() => { andThen(() => {
ok($('body.user-invites-page').length, "has the body class"); ok($('body.user-invites-page').length, "has the body class");
}); });
}); });
test("Messages", () => { test("Messages", () => {
visit("/users/eviltrout/messages"); visit("/u/eviltrout/messages");
andThen(() => { andThen(() => {
ok($('body.user-messages-page').length, "has the body class"); ok($('body.user-messages-page').length, "has the body class");
}); });
}); });
test("Notifications", () => { test("Notifications", () => {
visit("/users/eviltrout/notifications"); visit("/u/eviltrout/notifications");
andThen(() => { andThen(() => {
ok($('body.user-notifications-page').length, "has the body class"); ok($('body.user-notifications-page').length, "has the body class");
}); });
}); });
test("Root URL - Viewing Self", () => { test("Root URL - Viewing Self", () => {
visit("/users/eviltrout"); visit("/u/eviltrout");
andThen(() => { andThen(() => {
ok($('body.user-activity-page').length, "has the body class"); ok($('body.user-activity-page').length, "has the body class");
equal(currentPath(), 'user.userActivity.index', "it defaults to activity"); equal(currentPath(), 'user.userActivity.index', "it defaults to activity");

View File

@ -440,7 +440,7 @@ export default {
}, },
{ {
"id":94544, "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", "created_at":"2015-01-23T05:49:35.881Z",
"title":"After sign-in, I'm not redirected to the conversation", "title":"After sign-in, I'm not redirected to the conversation",
"url":"/t/after-sign-in-im-not-redirected-to-the-conversation/17753/8", "url":"/t/after-sign-in-im-not-redirected-to-the-conversation/17753/8",
@ -540,7 +540,7 @@ export default {
}, },
{ {
"id":94542, "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", "created_at":"2015-01-23T05:43:55.602Z",
"title":"RSS is not valid", "title":"RSS is not valid",
"url":"/t/rss-is-not-valid/24338/2", "url":"/t/rss-is-not-valid/24338/2",
@ -590,7 +590,7 @@ export default {
}, },
{ {
"id":94522, "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", "created_at":"2015-01-23T03:00:20.485Z",
"title":"Pasted image upload size error", "title":"Pasted image upload size error",
"url":"/t/pasted-image-upload-size-error/24320/4", "url":"/t/pasted-image-upload-size-error/24320/4",
@ -640,7 +640,7 @@ export default {
}, },
{ {
"id":94521, "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", "created_at":"2015-01-23T02:58:27.451Z",
"title":"The end of Clown Vomit, or, simplified category styles", "title":"The end of Clown Vomit, or, simplified category styles",
"url":"/t/the-end-of-clown-vomit-or-simplified-category-styles/24249/57", "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; var t, testClass;
testClass = Em.Object.extend({ testClass = Em.Object.extend({
userUrl: url('username', "/users/%@") userUrl: url('username', "/u/%@")
}); });
t = testClass.create({ username: 'eviltrout' }); 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"; Discourse.BaseUri = "/prefixed";
t = testClass.create({ username: 'eviltrout' }); 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() { test("getURL on subfolder install", function() {
Discourse.BaseUri = "/forum"; Discourse.BaseUri = "/forum";
equal(Discourse.getURL("/"), "/forum/", "root url has subfolder"); 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>", "<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."); "It doesn't strip the new line.");
cooked("1. View @eviltrout's profile here: http://meta.discourse.org/users/eviltrout/activity<br/>next line.", 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/users/eviltrout/activity\">http://meta.discourse.org/users/eviltrout/activity</a><br>next line.</li></ol>", "<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."); "allows autolinking within a list without inserting a paragraph.");
cooked("[3]: http://eviltrout.com", "", "It doesn't autolink markdown link references"); cooked("[3]: http://eviltrout.com", "", "It doesn't autolink markdown link references");

View File

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