Skip to content

Commit d6f0052

Browse files
committed
allow overwrite slug
1 parent dc42f07 commit d6f0052

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

server/hooks/create-slug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = function (options = { field: null }) {
1010
// do not overwrite existing slug
1111
// TODO: we should make that possible and relying on ids for routing insead only on slugs
1212
// the slug should be there for seo reasons but the id should be what counts
13-
if (!_.isEmpty(hook.data.slug)) return hook;
13+
if (!_.isEmpty(hook.data.slug) && (!options.overwrite && options.overwrite === false)) return hook;
1414

1515
return new Promise(resolve => {
1616

server/services/organizations/organizations.hooks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ module.exports = {
5555
excludeDisabled(),
5656
restrictToOwner()
5757
),
58-
createSlug({ field: 'name' }),
58+
createSlug({ field: 'name', overwrite: true }),
5959
createExcerpt({ field: 'description '}),
6060
saveRemoteImages(['logo', 'coverImg'])
6161
],
@@ -68,7 +68,7 @@ module.exports = {
6868
excludeDisabled(),
6969
restrictToOwner()
7070
),
71-
createSlug({ field: 'name' }),
71+
createSlug({ field: 'name', overwrite: true }),
7272
createExcerpt({ field: 'description' }),
7373
saveRemoteImages(['logo', 'coverImg'])
7474
],

0 commit comments

Comments
 (0)