Unverified Commit 3c5352fb authored by Seyed Sajad Kahani's avatar Seyed Sajad Kahani Committed by GitHub

fix: change reconnectLink behavior for page move (#1991)

parent 370cd100
...@@ -559,7 +559,7 @@ module.exports = class Page extends Model { ...@@ -559,7 +559,7 @@ module.exports = class Page extends Model {
}) })
} }
// -> Reconnect Links // -> Reconnect Links : Changing old links to the new path
await WIKI.models.pages.reconnectLinks({ await WIKI.models.pages.reconnectLinks({
sourceLocale: page.localeCode, sourceLocale: page.localeCode,
sourcePath: page.path, sourcePath: page.path,
...@@ -567,6 +567,13 @@ module.exports = class Page extends Model { ...@@ -567,6 +567,13 @@ module.exports = class Page extends Model {
path: opts.destinationPath, path: opts.destinationPath,
mode: 'move' mode: 'move'
}) })
// -> Reconnect Links : Validate invalid links to the new path
await WIKI.models.pages.reconnectLinks({
locale: opts.destinationLocale,
path: opts.destinationPath,
mode: 'create'
})
} }
/** /**
...@@ -655,7 +662,7 @@ module.exports = class Page extends Model { ...@@ -655,7 +662,7 @@ module.exports = class Page extends Model {
break break
case 'move': case 'move':
const prevPageHref = `/${opts.sourceLocale}/${opts.sourcePath}` const prevPageHref = `/${opts.sourceLocale}/${opts.sourcePath}`
replaceArgs.from = `<a href="${prevPageHref}" class="is-internal-link is-invalid-page">` replaceArgs.from = `<a href="${prevPageHref}" class="is-internal-link is-valid-page">`
replaceArgs.to = `<a href="${pageHref}" class="is-internal-link is-valid-page">` replaceArgs.to = `<a href="${pageHref}" class="is-internal-link is-valid-page">`
break break
case 'delete': case 'delete':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment