|
|
@@ -12,6 +12,14 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
, actions = {};
|
|
|
|
|
|
+ // register page events
|
|
|
+
|
|
|
+ var pageEvent = crowi.event('page');
|
|
|
+ pageEvent.on('update', function(page, user) {
|
|
|
+ crowi.getIo().sockets.emit('page edited', {page, user});
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
function getPathFromRequest(req) {
|
|
|
var path = '/' + (req.params[0] || '');
|
|
|
return path.replace(/\.md$/, '');
|
|
|
@@ -395,7 +403,6 @@ module.exports = function(crowi, app) {
|
|
|
throw new Error('Data not found');
|
|
|
}
|
|
|
// TODO: move to events
|
|
|
- crowi.getIo().sockets.emit('page edited', {page: data, user: req.user});
|
|
|
if (notify.slack) {
|
|
|
if (notify.slack.on && notify.slack.channel) {
|
|
|
data.updateSlackChannel(notify.slack.channel).then(function(){}).catch(function(){});
|