Duplicative method cleanup (#6431)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import filter from "lodash/filter";
|
||||
import orderBy from "lodash/orderBy";
|
||||
import { action, computed } from "mobx";
|
||||
import Comment from "~/models/Comment";
|
||||
@@ -18,8 +17,9 @@ export default class CommentsStore extends Store<Comment> {
|
||||
* @returns Array of comments
|
||||
*/
|
||||
threadsInDocument(documentId: string): Comment[] {
|
||||
return this.inDocument(documentId).filter(
|
||||
(comment) => !comment.parentCommentId
|
||||
return this.filter(
|
||||
(comment: Comment) =>
|
||||
comment.documentId === documentId && !comment.parentCommentId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -30,26 +30,12 @@ export default class CommentsStore extends Store<Comment> {
|
||||
* @returns Array of comments
|
||||
*/
|
||||
inThread(threadId: string): Comment[] {
|
||||
return filter(
|
||||
this.orderedData,
|
||||
(comment) =>
|
||||
return this.filter(
|
||||
(comment: Comment) =>
|
||||
comment.parentCommentId === threadId || comment.id === threadId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of comments in a document.
|
||||
*
|
||||
* @param documentId ID of the document to get comments for
|
||||
* @returns Array of comments
|
||||
*/
|
||||
inDocument(documentId: string): Comment[] {
|
||||
return filter(
|
||||
this.orderedData,
|
||||
(comment) => comment.documentId === documentId
|
||||
);
|
||||
}
|
||||
|
||||
@action
|
||||
setTyping({
|
||||
commentId,
|
||||
|
||||
Reference in New Issue
Block a user