{{/* TODO: At the moment, two kinds of request handler call this template: * ExcerptBlob -> blob_excerpt.tmpl -> this * Other compare and diff pages -> ... -> {section_unified.tmpl|section_split.tmpl} -> this) The variables in "ctx.Data" are different in each case, making this template fragile, hard to read and maintain. */}} {{if len .comments}} {{$firstComment := index .comments 0 -}} {{$invalid := $firstComment.Invalidated -}} {{$resolved := $firstComment.IsResolved -}} {{$resolveDoer := $firstComment.ResolveDoer -}} {{$hasReview := and $firstComment.Review -}} {{$isReviewPending := and $hasReview (eq $firstComment.Review.Type 0) -}} {{$root := ctx.RootData -}} {{$repo := $root.Repository -}} {{$repoLink := $root.RepoLink -}} {{$editorconfig := $root.Editorconfig -}} {{$canWrite := or $root.Permission.IsAdmin $root.HasIssuesOrPullsWritePermission -}} {{$signedUserID := or $root.SignedUserID NIL -}} {{$canMarkAsResolved := and $root.CanMarkConversation $hasReview (not $isReviewPending)}} {{$canAddComment := and $root.SignedUserID (not $root.Repository.IsArchived)}}