(comment: IssueComment, incrementCount: boolean)
| 51 | } |
| 52 | |
| 53 | public insertComment(comment: IssueComment, incrementCount: boolean) { |
| 54 | const component = new CommentComponent( |
| 55 | comment, |
| 56 | this.user ? this.user.login : null, |
| 57 | this.issue!.locked); |
| 58 | |
| 59 | const index = this.timeline.findIndex(x => x.comment.id >= comment.id); |
| 60 | if (index === -1) { |
| 61 | this.timeline.push(component); |
| 62 | this.element.insertBefore(component.element, this.marker); |
| 63 | } else { |
| 64 | const next = this.timeline[index]; |
| 65 | const remove = next.comment.id === comment.id; |
| 66 | this.element.insertBefore(component.element, next.element); |
| 67 | this.timeline.splice(index, remove ? 1 : 0, component); |
| 68 | if (remove) { |
| 69 | next.element.remove(); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | if (incrementCount) { |
| 74 | this.count++; |
| 75 | this.renderCount(); |
| 76 | } |
| 77 | |
| 78 | scheduleMeasure(); |
| 79 | } |
| 80 | |
| 81 | public insertPageLoader(insertAfter: IssueComment, count: number, callback: () => void) { |
| 82 | const { element: insertAfterElement } = this.timeline.find(x => x.comment.id >= insertAfter.id)!; |
no test coverage detected