Merge master

This commit is contained in:
Tom Moor
2017-09-13 19:18:49 -07:00
27 changed files with 581 additions and 144 deletions

View File

@@ -38,3 +38,19 @@ export function searchUrl(query?: string): string {
export function notFoundUrl(): string {
return '/404';
}
export const matchDocumentSlug =
':documentSlug([0-9a-zA-Z-]*-[a-zA-z0-9]{10,15})';
export const matchDocumentEdit = `/doc/${matchDocumentSlug}/edit`;
export const matchDocumentMove = `/doc/${matchDocumentSlug}/move`;
/**
* Replace full url's document part with the new one in case
* the document slug has been updated
*/
export function updateDocumentUrl(oldUrl: string, newUrl: string): string {
// Update url to match the current one
const urlParts = oldUrl.split('/');
return [newUrl, urlParts.slice(3)].join('/');
}