Niedzielski has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/380902 )

Change subject: Chore: move page summaries to distinct endpoint
......................................................................

Chore: move page summaries to distinct endpoint

Move page summaries to a new endpoint, `page/summary/:title`, to allow
wiki pages and page summaries to coexist.

Bug: T173324
Change-Id: Iecd3887a47ccf861f4f7417810b8080dbd9ee8f4
---
M src/common/pages/home.tsx
R src/common/pages/summary.tsx
M src/common/routers/api.test.ts
M src/common/routers/api.ts
4 files changed, 19 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/02/380902/1

diff --git a/src/common/pages/home.tsx b/src/common/pages/home.tsx
index 80dc985..38f119d 100644
--- a/src/common/pages/home.tsx
+++ b/src/common/pages/home.tsx
@@ -1,6 +1,6 @@
 import { h } from "preact";
 import App from "../components/app/app";
-import { about, home, wiki, styleGuide } from "../../common/routers/api";
+import { about, home, summary, styleGuide } from "../../common/routers/api";
 import Page from "../components/page/page";
 import Link from "../components/link";
 
@@ -22,21 +22,23 @@
           <Link href={styleGuide.url(undefined)}>Style Guide</Link>
         </li>
         <li>
-          <Link href={wiki.url({ title: "Banana" })}>Banana</Link>
+          <Link href={summary.url({ title: "Banana" })}>Banana</Link>
         </li>
         <li>
-          <Link href={wiki.url({ title: "Bill_&_Ted's_Excellent_Adventure" })}>
+          <Link
+            href={summary.url({ title: "Bill_&_Ted's_Excellent_Adventure" })}
+          >
             Bill & Ted's Excellent Adventure
           </Link>
         </li>
         <li>
-          <Link href={wiki.url({ title: "Cucumber" })}>Cucumber</Link>
+          <Link href={summary.url({ title: "Cucumber" })}>Cucumber</Link>
         </li>
         <li>
-          <Link href={wiki.url({ title: "Ice_cream" })}>Ice cream</Link>
+          <Link href={summary.url({ title: "Ice_cream" })}>Ice cream</Link>
         </li>
         <li>
-          <Link href={wiki.url({ title: "Plaintext" })}>
+          <Link href={summary.url({ title: "Plaintext" })}>
             Article without image
           </Link>
         </li>
diff --git a/src/common/pages/wiki.tsx b/src/common/pages/summary.tsx
similarity index 100%
rename from src/common/pages/wiki.tsx
rename to src/common/pages/summary.tsx
diff --git a/src/common/routers/api.test.ts b/src/common/routers/api.test.ts
index 6c1d769..9627afd 100644
--- a/src/common/routers/api.test.ts
+++ b/src/common/routers/api.test.ts
@@ -1,5 +1,5 @@
 import * as assert from "assert";
-import { home, about, wiki, styleGuide, notFound } from "./api";
+import { home, about, summary, styleGuide, notFound } from "./api";
 import { Route, RouteParams } from "./route";
 
 const testPathParams = <Params extends RouteParams | void, Props>({
@@ -33,9 +33,9 @@
   // eslint-disable-next-line max-len
   describe("each route's path, URL parameters, and route parameters match:", 
() => {
     [
-      { name: "wiki", route: wiki, params: { title: "title" } },
       { name: "home", route: home, params: undefined },
       { name: "about", route: about, params: undefined },
+      { name: "summary", route: summary, params: { title: "title" } },
       { name: "styleGuide", route: styleGuide, params: undefined },
       { name: "notFound", route: notFound, params: { 0: "/404" } }
     ].forEach(testPathParams);
diff --git a/src/common/routers/api.ts b/src/common/routers/api.ts
index 5297704..68d6064 100644
--- a/src/common/routers/api.ts
+++ b/src/common/routers/api.ts
@@ -1,5 +1,8 @@
 import { Params as NotFoundParams } from "../pages/not-found";
-import { Props as WikiProps, Params as WikiParams } from "../pages/wiki";
+import {
+  Props as SummaryProps,
+  Params as SummaryParams
+} from "../pages/summary";
 import { AnyRoute, Route, newRoute } from "./route";
 
 export const home: Route = newRoute({
@@ -18,11 +21,11 @@
   status: 200
 });
 
-export const wiki: Route<WikiParams, WikiProps> = newRoute({
-  path: "/wiki/:title",
+export const summary: Route<SummaryParams, SummaryProps> = newRoute({
+  path: "/page/summary/:title",
   importModule: () =>
-    import(/* webpackChunkName: "pages/wiki" */ "../pages/wiki"),
-  chunkName: "pages/wiki",
+    import(/* webpackChunkName: "pages/summary" */ "../pages/summary"),
+  chunkName: "pages/summary",
   status: 200
 });
 
@@ -44,4 +47,4 @@
   status: 404
 });
 
-export const routes: AnyRoute[] = [home, about, wiki, styleGuide, notFound];
+export const routes: AnyRoute[] = [home, about, summary, styleGuide, notFound];

-- 
To view, visit https://gerrit.wikimedia.org/r/380902
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecd3887a47ccf861f4f7417810b8080dbd9ee8f4
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: Sniedzielski <sniedziel...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to