Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
28fdf140
Commit
28fdf140
authored
Oct 27, 2019
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: export + import tags in storage events
parent
692e5ca0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
page.js
server/helpers/page.js
+1
-1
tags.js
server/models/tags.js
+2
-0
common.js
server/modules/storage/disk/common.js
+5
-2
No files found.
server/helpers/page.js
View file @
28fdf140
...
@@ -71,7 +71,7 @@ module.exports = {
...
@@ -71,7 +71,7 @@ module.exports = {
[
'description'
,
page
.
description
],
[
'description'
,
page
.
description
],
[
'published'
,
page
.
isPublished
.
toString
()],
[
'published'
,
page
.
isPublished
.
toString
()],
[
'date'
,
page
.
updatedAt
],
[
'date'
,
page
.
updatedAt
],
[
'tags'
,
''
]
[
'tags'
,
page
.
tags
?
page
.
tags
.
map
(
t
=>
t
.
tag
).
join
(
', '
)
:
''
]
]
]
const
inject
=
{
const
inject
=
{
'markdown'
:
'---
\
n'
+
meta
.
map
(
mt
=>
`
${
mt
[
0
]}
:
${
mt
[
1
]}
`
).
join
(
'
\
n'
)
+
'
\
n---
\
n
\
n'
+
page
.
content
,
'markdown'
:
'---
\
n'
+
meta
.
map
(
mt
=>
`
${
mt
[
0
]}
:
${
mt
[
1
]}
`
).
join
(
'
\
n'
)
+
'
\
n---
\
n
\
n'
+
page
.
content
,
...
...
server/models/tags.js
View file @
28fdf140
...
@@ -95,5 +95,7 @@ module.exports = class Tag extends Model {
...
@@ -95,5 +95,7 @@ module.exports = class Tag extends Model {
if
(
tagsToUnrelate
.
length
>
0
)
{
if
(
tagsToUnrelate
.
length
>
0
)
{
await
page
.
$relatedQuery
(
'tags'
).
unrelate
().
whereIn
(
'tags.id'
,
_
.
map
(
tagsToUnrelate
,
'id'
))
await
page
.
$relatedQuery
(
'tags'
).
unrelate
().
whereIn
(
'tags.id'
,
_
.
map
(
tagsToUnrelate
,
'id'
))
}
}
page
.
tags
=
targetTags
}
}
}
}
server/modules/storage/disk/common.js
View file @
28fdf140
...
@@ -75,10 +75,11 @@ module.exports = {
...
@@ -75,10 +75,11 @@ module.exports = {
const
contentPath
=
pageHelper
.
getPagePath
(
relPath
)
const
contentPath
=
pageHelper
.
getPagePath
(
relPath
)
const
itemContents
=
await
fs
.
readFile
(
path
.
join
(
fullPath
,
relPath
),
'utf8'
)
const
itemContents
=
await
fs
.
readFile
(
path
.
join
(
fullPath
,
relPath
),
'utf8'
)
const
pageData
=
WIKI
.
models
.
pages
.
parseMetadata
(
itemContents
,
contentType
)
const
pageData
=
WIKI
.
models
.
pages
.
parseMetadata
(
itemContents
,
contentType
)
const
currentPage
=
await
WIKI
.
models
.
pages
.
query
().
findOne
({
const
currentPage
=
await
WIKI
.
models
.
pages
.
getPageFromDb
({
path
:
contentPath
.
path
,
path
:
contentPath
.
path
,
locale
Code
:
contentPath
.
locale
locale
:
contentPath
.
locale
})
})
const
newTags
=
!
_
.
isNil
(
pageData
.
tags
)
?
_
.
get
(
pageData
,
'tags'
,
''
).
split
(
', '
)
:
false
if
(
currentPage
)
{
if
(
currentPage
)
{
// Already in the DB, can mark as modified
// Already in the DB, can mark as modified
WIKI
.
logger
.
info
(
`(STORAGE/
${
moduleName
}
) Page marked as modified:
${
relPath
}
`
)
WIKI
.
logger
.
info
(
`(STORAGE/
${
moduleName
}
) Page marked as modified:
${
relPath
}
`
)
...
@@ -86,6 +87,7 @@ module.exports = {
...
@@ -86,6 +87,7 @@ module.exports = {
id
:
currentPage
.
id
,
id
:
currentPage
.
id
,
title
:
_
.
get
(
pageData
,
'title'
,
currentPage
.
title
),
title
:
_
.
get
(
pageData
,
'title'
,
currentPage
.
title
),
description
:
_
.
get
(
pageData
,
'description'
,
currentPage
.
description
)
||
''
,
description
:
_
.
get
(
pageData
,
'description'
,
currentPage
.
description
)
||
''
,
tags
:
newTags
||
currentPage
.
tags
.
map
(
t
=>
t
.
tag
),
isPublished
:
_
.
get
(
pageData
,
'isPublished'
,
currentPage
.
isPublished
),
isPublished
:
_
.
get
(
pageData
,
'isPublished'
,
currentPage
.
isPublished
),
isPrivate
:
false
,
isPrivate
:
false
,
content
:
pageData
.
content
,
content
:
pageData
.
content
,
...
@@ -101,6 +103,7 @@ module.exports = {
...
@@ -101,6 +103,7 @@ module.exports = {
locale
:
contentPath
.
locale
,
locale
:
contentPath
.
locale
,
title
:
_
.
get
(
pageData
,
'title'
,
_
.
last
(
contentPath
.
path
.
split
(
'/'
))),
title
:
_
.
get
(
pageData
,
'title'
,
_
.
last
(
contentPath
.
path
.
split
(
'/'
))),
description
:
_
.
get
(
pageData
,
'description'
,
''
)
||
''
,
description
:
_
.
get
(
pageData
,
'description'
,
''
)
||
''
,
tags
:
newTags
||
[],
isPublished
:
_
.
get
(
pageData
,
'isPublished'
,
true
),
isPublished
:
_
.
get
(
pageData
,
'isPublished'
,
true
),
isPrivate
:
false
,
isPrivate
:
false
,
content
:
pageData
.
content
,
content
:
pageData
.
content
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment