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
405187b8
Commit
405187b8
authored
Apr 19, 2020
by
NGPixel
Committed by
Nicolas Giard
Apr 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: HA event publish
parent
bd4263ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
db.js
server/core/db.js
+3
-3
pages.js
server/models/pages.js
+4
-4
No files found.
server/core/db.js
View file @
405187b8
...
@@ -207,8 +207,8 @@ module.exports = {
...
@@ -207,8 +207,8 @@ module.exports = {
// -> Outbound events handling
// -> Outbound events handling
this
.
listener
.
addChannel
(
'wiki'
,
payload
=>
{
this
.
listener
.
addChannel
(
'wiki'
,
payload
=>
{
if
(
_
.
has
(
payload
.
event
)
&&
payload
.
source
!==
WIKI
.
INSTANCE_ID
)
{
if
(
_
.
has
(
payload
,
'event'
)
&&
payload
.
source
!==
WIKI
.
INSTANCE_ID
)
{
WIKI
.
logger
.
debug
(
`Received event
${
payload
.
event
}
from instance
${
payload
.
source
}
: [ OK ]`
)
WIKI
.
logger
.
info
(
`Received event
${
payload
.
event
}
from instance
${
payload
.
source
}
: [ OK ]`
)
WIKI
.
events
.
inbound
.
emit
(
payload
.
event
,
payload
.
value
)
WIKI
.
events
.
inbound
.
emit
(
payload
.
event
,
payload
.
value
)
}
}
})
})
...
@@ -239,7 +239,7 @@ module.exports = {
...
@@ -239,7 +239,7 @@ module.exports = {
* @param {object} value Payload of the event
* @param {object} value Payload of the event
*/
*/
notifyViaDB
(
event
,
value
)
{
notifyViaDB
(
event
,
value
)
{
thi
s
.
listener
.
publish
(
'wiki'
,
{
WIKI
.
model
s
.
listener
.
publish
(
'wiki'
,
{
source
:
WIKI
.
INSTANCE_ID
,
source
:
WIKI
.
INSTANCE_ID
,
event
,
event
,
value
value
...
...
server/models/pages.js
View file @
405187b8
...
@@ -350,6 +350,7 @@ module.exports = class Page extends Model {
...
@@ -350,6 +350,7 @@ module.exports = class Page extends Model {
// -> Render page to HTML
// -> Render page to HTML
await
WIKI
.
models
.
pages
.
renderPage
(
page
)
await
WIKI
.
models
.
pages
.
renderPage
(
page
)
WIKI
.
events
.
outbound
.
emit
(
'deletePageFromCache'
,
page
.
hash
)
// -> Update Search Index
// -> Update Search Index
const
pageContents
=
await
WIKI
.
models
.
pages
.
query
().
findById
(
page
.
id
).
select
(
'render'
)
const
pageContents
=
await
WIKI
.
models
.
pages
.
query
().
findById
(
page
.
id
).
select
(
'render'
)
...
@@ -804,12 +805,11 @@ module.exports = class Page extends Model {
...
@@ -804,12 +805,11 @@ module.exports = class Page extends Model {
/**
/**
* Delete an Existing Page from Cache
* Delete an Existing Page from Cache
*
*
* @param {Object} page Page Model Instance
* @param {String} page Page Unique Hash
* @param {string} page.hash Hash of the Page
* @returns {Promise} Promise with no value
* @returns {Promise} Promise with no value
*/
*/
static
async
deletePageFromCache
(
page
)
{
static
async
deletePageFromCache
(
hash
)
{
return
fs
.
remove
(
path
.
resolve
(
WIKI
.
ROOTPATH
,
WIKI
.
config
.
dataPath
,
`cache/
${
page
.
hash
}
.bin`
))
return
fs
.
remove
(
path
.
resolve
(
WIKI
.
ROOTPATH
,
WIKI
.
config
.
dataPath
,
`cache/
${
hash
}
.bin`
))
}
}
/**
/**
...
...
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