Fix ticket viewer bug (#1105)

* Fix ticket viewer bug

* Fix ticket viewer bug
This commit is contained in:
LautaroCesso 2021-11-29 19:49:39 -03:00 committed by GitHub
parent 402af565a9
commit e7daf76274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -86,16 +86,16 @@ class TicketViewer extends React.Component {
const { editTitle, loading, edit, editId } = this.state;
const { closed, author, content, date, edited, file, events} = ticket;
const showResponseField = (!closed && (editable || !assignmentAllowed));
const lastCommentIndex = events.map(
const lastComment = events.map(
(event, index) => {
return {...event, index}}
).filter(
(event) => event.type === "COMMENT"
).at(-1).index;
).at(-1);
const eventsWithModifiedComments = events.map(
(event, index) => {
return {...event, isLastComment: index === lastCommentIndex && event.type === "COMMENT"};
return {...event, isLastComment: lastComment && index === lastComment.index && event.type === "COMMENT"};
}
);