|
|
@@ -16,7 +16,7 @@ module.exports = function(crowi, app) {
|
|
|
, pagePathUtil = require('../util/pagePathUtil')
|
|
|
, swig = require('swig-templates')
|
|
|
, getToday = require('../util/getToday')
|
|
|
- , notification = crowi.getGlobalNotificationService()
|
|
|
+ , globalNotificationService = crowi.getGlobalNotificationService()
|
|
|
|
|
|
, actions = {};
|
|
|
|
|
|
@@ -705,21 +705,21 @@ module.exports = function(crowi, app) {
|
|
|
if (data) {
|
|
|
previousRevision = data.revision;
|
|
|
return Page.updatePage(data, body, req.user, { grant, grantUserGroupId })
|
|
|
- .then((page) => {
|
|
|
- // global notification
|
|
|
- notification.notifyPageEdit(page);
|
|
|
- return page;
|
|
|
- });
|
|
|
+ .then((page) => {
|
|
|
+ // global notification
|
|
|
+ globalNotificationService.notifyPageEdit(page);
|
|
|
+ return page;
|
|
|
+ });
|
|
|
}
|
|
|
else {
|
|
|
// new page
|
|
|
updateOrCreate = 'create';
|
|
|
return Page.create(path, body, req.user, { grant, grantUserGroupId })
|
|
|
- .then((page) => {
|
|
|
- // global notification
|
|
|
- notification.notifyPageCreate(page);
|
|
|
- return page;
|
|
|
- });
|
|
|
+ .then((page) => {
|
|
|
+ // global notification
|
|
|
+ globalNotificationService.notifyPageCreate(page);
|
|
|
+ return page;
|
|
|
+ });
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
// data is a saved page data with revision.
|
|
|
@@ -1001,17 +1001,19 @@ module.exports = function(crowi, app) {
|
|
|
Page.findPageByIdAndGrantedUser(id, req.user)
|
|
|
.then(function(pageData) {
|
|
|
return pageData.like(req.user);
|
|
|
- }).then(function(page) {
|
|
|
+ })
|
|
|
+ .then(function(page) {
|
|
|
var result = {page: page};
|
|
|
res.json(ApiResponse.success(result));
|
|
|
return page;
|
|
|
- }).catch(function(err) {
|
|
|
+ })
|
|
|
+ .catch(function(err) {
|
|
|
debug('Like failed', err);
|
|
|
return res.json(ApiResponse.error({}));
|
|
|
})
|
|
|
.then((page) => {
|
|
|
// global notification
|
|
|
- return notification.notifyPageLike(page, req.user);
|
|
|
+ return globalNotificationService.notifyPageLike(page, req.user);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
@@ -1121,7 +1123,7 @@ module.exports = function(crowi, app) {
|
|
|
})
|
|
|
.then((page) => {
|
|
|
// global notification
|
|
|
- return notification.notifyPageDelete(page);
|
|
|
+ return globalNotificationService.notifyPageDelete(page);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
@@ -1218,7 +1220,7 @@ module.exports = function(crowi, app) {
|
|
|
})
|
|
|
.then(() => {
|
|
|
// global notification
|
|
|
- notification.notifyPageMove(page, req.body.path, req.user);
|
|
|
+ globalNotificationService.notifyPageMove(page, req.body.path, req.user);
|
|
|
});
|
|
|
});
|
|
|
|