Просмотр исходного кода

fix methods skeleton

https://youtrack.weseek.co.jp/issue/GW-7776
- Remove method implementation in commentEvent create
- Remove sendNotificationToMentionedUsers and getUserModel method
- Move getMentionedUsers to createAndSendNotifications and merge the results to targetUsers variable
I Komang Mudana 3 лет назад
Родитель
Сommit
8e5ce89e74
1 измененных файлов с 5 добавлено и 17 удалено
  1. 5 17
      packages/app/src/server/service/comment.ts

+ 5 - 17
packages/app/src/server/service/comment.ts

@@ -47,10 +47,6 @@ class CommentService {
 
         const activity = await this.createActivity(savedComment, SUPPORTED_ACTION_TYPE.ACTION_COMMENT_CREATE);
         await this.createAndSendNotifications(activity, page);
-
-        // TODO:   Send inAppNotification to mentioned users
-        // const mentionedUsers = await this.getMentionedUsers(savedComment.comment);
-        // await this.sendNotificationToMentionedUsers(mentionedUsers, activity, page);
       }
       catch (err) {
         logger.error('Error occurred while handling the comment create event:\n', err);
@@ -103,29 +99,21 @@ class CommentService {
     let targetUsers: Types.ObjectId[] = [];
     targetUsers = await activity.getNotificationTargetUsers();
 
+    // TODO get mentioned users from comment
+    // const mentionedUsers = await this.getMentionedUsers(page.event);
+    // targetUsers = targetUsers.concat(mentionedUsers);
     // Create and send notifications
     await this.inAppNotificationService.upsertByActivity(targetUsers, activity, snapshot);
     await this.inAppNotificationService.emitSocketIo(targetUsers);
   };
 
-  private getMentionedUsers = async(comment: string) => {
-    // TODO extract users from comment
+  private getMentionedUsers = async(comment: Types.ObjectId) => {
+    // TODO extract users from comment model
     // Implement User model to find users ID
 
     // return User ObjectID array
   }
 
-  private sendNotificationToMentionedUsers = async(mentionedUsers: Types.ObjectId[], activity:any, page:any) => {
-    // TODO implement inAppNotificationService with target mentioned users
-    // inAppNotificationService.upsertByActivity
-    // Call inAppNotificationService.emitSocketIo;
-  }
-
-  private getUserModel = () => {
-    // TODO get users model
-    // return users Model
-  }
-
 }