|
|
@@ -6,7 +6,7 @@ import escapeStringRegexp from 'escape-string-regexp';
|
|
|
import mongoose, { ObjectId, QueryCursor } from 'mongoose';
|
|
|
import streamToPromise from 'stream-to-promise';
|
|
|
|
|
|
-import { supportedTargetModelNames, supportedActionNames } from '~/interfaces/activity';
|
|
|
+import { SUPPORTED_TARGET_MODEL_TYPE, SUPPORTED_ACTION_TYPE } from '~/interfaces/activity';
|
|
|
import { Ref } from '~/interfaces/common';
|
|
|
import { HasObjectId } from '~/interfaces/has-object-id';
|
|
|
import {
|
|
|
@@ -157,7 +157,7 @@ class PageService {
|
|
|
this.pageEvent.onUpdate();
|
|
|
|
|
|
try {
|
|
|
- await this.createAndSendNotifications(page, user, supportedActionNames.ACTION_PAGE_UPDATE);
|
|
|
+ await this.createAndSendNotifications(page, user, SUPPORTED_ACTION_TYPE.ACTION_PAGE_UPDATE);
|
|
|
}
|
|
|
catch (err) {
|
|
|
logger.error(err);
|
|
|
@@ -167,7 +167,7 @@ class PageService {
|
|
|
// rename
|
|
|
this.pageEvent.on('rename', async(page, user) => {
|
|
|
try {
|
|
|
- await this.createAndSendNotifications(page, user, supportedActionNames.ACTION_PAGE_RENAME);
|
|
|
+ await this.createAndSendNotifications(page, user, SUPPORTED_ACTION_TYPE.ACTION_PAGE_RENAME);
|
|
|
}
|
|
|
catch (err) {
|
|
|
logger.error(err);
|
|
|
@@ -177,7 +177,7 @@ class PageService {
|
|
|
// duplicate
|
|
|
this.pageEvent.on('duplicate', async(page, user) => {
|
|
|
try {
|
|
|
- await this.createAndSendNotifications(page, user, supportedActionNames.ACTION_PAGE_DUPLICATE);
|
|
|
+ await this.createAndSendNotifications(page, user, SUPPORTED_ACTION_TYPE.ACTION_PAGE_DUPLICATE);
|
|
|
}
|
|
|
catch (err) {
|
|
|
logger.error(err);
|
|
|
@@ -187,7 +187,7 @@ class PageService {
|
|
|
// delete
|
|
|
this.pageEvent.on('delete', async(page, user) => {
|
|
|
try {
|
|
|
- await this.createAndSendNotifications(page, user, supportedActionNames.ACTION_PAGE_DELETE);
|
|
|
+ await this.createAndSendNotifications(page, user, SUPPORTED_ACTION_TYPE.ACTION_PAGE_DELETE);
|
|
|
}
|
|
|
catch (err) {
|
|
|
logger.error(err);
|
|
|
@@ -197,7 +197,7 @@ class PageService {
|
|
|
// delete completely
|
|
|
this.pageEvent.on('deleteCompletely', async(page, user) => {
|
|
|
try {
|
|
|
- await this.createAndSendNotifications(page, user, supportedActionNames.ACTION_PAGE_DELETE_COMPLETELY);
|
|
|
+ await this.createAndSendNotifications(page, user, SUPPORTED_ACTION_TYPE.ACTION_PAGE_DELETE_COMPLETELY);
|
|
|
}
|
|
|
catch (err) {
|
|
|
logger.error(err);
|
|
|
@@ -207,7 +207,7 @@ class PageService {
|
|
|
// revert
|
|
|
this.pageEvent.on('revert', async(page, user) => {
|
|
|
try {
|
|
|
- await this.createAndSendNotifications(page, user, supportedActionNames.ACTION_PAGE_REVERT);
|
|
|
+ await this.createAndSendNotifications(page, user, SUPPORTED_ACTION_TYPE.ACTION_PAGE_REVERT);
|
|
|
}
|
|
|
catch (err) {
|
|
|
logger.error(err);
|
|
|
@@ -217,7 +217,7 @@ class PageService {
|
|
|
// likes
|
|
|
this.pageEvent.on('like', async(page, user) => {
|
|
|
try {
|
|
|
- await this.createAndSendNotifications(page, user, supportedActionNames.ACTION_PAGE_LIKE);
|
|
|
+ await this.createAndSendNotifications(page, user, SUPPORTED_ACTION_TYPE.ACTION_PAGE_LIKE);
|
|
|
}
|
|
|
catch (err) {
|
|
|
logger.error(err);
|
|
|
@@ -227,7 +227,7 @@ class PageService {
|
|
|
// bookmark
|
|
|
this.pageEvent.on('bookmark', async(page, user) => {
|
|
|
try {
|
|
|
- await this.createAndSendNotifications(page, user, supportedActionNames.ACTION_PAGE_BOOKMARK);
|
|
|
+ await this.createAndSendNotifications(page, user, SUPPORTED_ACTION_TYPE.ACTION_PAGE_BOOKMARK);
|
|
|
}
|
|
|
catch (err) {
|
|
|
logger.error(err);
|
|
|
@@ -2237,7 +2237,7 @@ class PageService {
|
|
|
// Create activity
|
|
|
const parameters = {
|
|
|
user: user._id,
|
|
|
- targetModel: supportedTargetModelNames.MODEL_PAGE,
|
|
|
+ targetModel: SUPPORTED_TARGET_MODEL_TYPE.MODEL_PAGE,
|
|
|
target: page,
|
|
|
action,
|
|
|
};
|