FEATURE: SiteSetting to default user path to different routes (#20962)
This commit is contained in:
parent
17ba00c395
commit
73325c6c35
|
@ -26,7 +26,12 @@ export default {
|
|||
let siteSettings = container.lookup("service:site-settings");
|
||||
initializeDefaultHomepage(siteSettings);
|
||||
|
||||
DiscourseURL.rewrite(/^\/u\/([^\/]+)\/?$/, "/u/$1/summary", {
|
||||
let defaultUserRoute = siteSettings.view_user_route || "summary";
|
||||
if (!container.lookup(`route:user.${defaultUserRoute}`)) {
|
||||
defaultUserRoute = "summary";
|
||||
}
|
||||
|
||||
DiscourseURL.rewrite(/^\/u\/([^\/]+)\/?$/, `/u/$1/${defaultUserRoute}`, {
|
||||
exceptions: [
|
||||
"/u/account-created",
|
||||
"/users/account-created",
|
||||
|
|
|
@ -335,6 +335,30 @@ acceptance(
|
|||
}
|
||||
);
|
||||
|
||||
acceptance("User - Invalid view_user_route setting", function (needs) {
|
||||
needs.settings({
|
||||
view_user_route: "X",
|
||||
});
|
||||
|
||||
test("It defaults to summary", async function (assert) {
|
||||
await visit("/u/eviltrout");
|
||||
|
||||
assert.strictEqual(currentRouteName(), "user.summary");
|
||||
});
|
||||
});
|
||||
|
||||
acceptance("User - Valid view_user_route setting", function (needs) {
|
||||
needs.settings({
|
||||
view_user_route: "activity",
|
||||
});
|
||||
|
||||
test("It defaults to summary", async function (assert) {
|
||||
await visit("/u/eviltrout");
|
||||
|
||||
assert.strictEqual(currentRouteName(), "userActivity.index");
|
||||
});
|
||||
});
|
||||
|
||||
acceptance("User - Logout", function (needs) {
|
||||
needs.user({ username: "eviltrout" });
|
||||
|
||||
|
|
|
@ -2466,6 +2466,11 @@ uncategorized:
|
|||
default: 0
|
||||
hidden: true
|
||||
|
||||
view_user_route:
|
||||
default: "summary"
|
||||
hidden: true
|
||||
client: true
|
||||
|
||||
tos_topic_id:
|
||||
default: -1
|
||||
hidden: true
|
||||
|
|
Loading…
Reference in New Issue