@@ -17,7 +17,9 @@ type Comment interface {
1717 Association () string
1818 Content () string
1919 Created () time.Time
20+ HiddenReason () string
2021 IsEdited () bool
22+ IsHidden () bool
2123 Link () string
2224 Reactions () api.ReactionGroups
2325 Status () string
@@ -33,6 +35,9 @@ func RawCommentList(comments api.Comments, reviews api.PullRequestReviews) strin
3335}
3436
3537func formatRawComment (comment Comment ) string {
38+ if comment .IsHidden () {
39+ return ""
40+ }
3641 var b strings.Builder
3742 fmt .Fprintf (& b , "author:\t %s\n " , comment .AuthorLogin ())
3843 fmt .Fprintf (& b , "association:\t %s\n " , strings .ToLower (comment .Association ()))
@@ -55,7 +60,7 @@ func CommentList(io *iostreams.IOStreams, comments api.Comments, reviews api.Pul
5560 retrievedCount := len (sortedComments )
5661 hiddenCount := totalCount - retrievedCount
5762
58- if hiddenCount > 0 {
63+ if preview && hiddenCount > 0 {
5964 fmt .Fprint (& b , cs .Gray (fmt .Sprintf ("———————— Not showing %s ————————" , utils .Pluralize (hiddenCount , "comment" ))))
6065 fmt .Fprintf (& b , "\n \n \n " )
6166 }
@@ -72,7 +77,7 @@ func CommentList(io *iostreams.IOStreams, comments api.Comments, reviews api.Pul
7277 }
7378 }
7479
75- if hiddenCount > 0 {
80+ if preview && hiddenCount > 0 {
7681 fmt .Fprint (& b , cs .Gray ("Use --comments to view the full conversation" ))
7782 fmt .Fprintln (& b )
7883 }
@@ -84,6 +89,10 @@ func formatComment(io *iostreams.IOStreams, comment Comment, newest bool) (strin
8489 var b strings.Builder
8590 cs := io .ColorScheme ()
8691
92+ if comment .IsHidden () {
93+ return cs .Bold (formatHiddenComment (comment )), nil
94+ }
95+
8796 // Header
8897 fmt .Fprint (& b , cs .Bold (comment .AuthorLogin ()))
8998 if comment .Status () != "" {
@@ -182,3 +191,13 @@ func formatRawCommentStatus(status string) string {
182191
183192 return "none"
184193}
194+
195+ func formatHiddenComment (comment Comment ) string {
196+ var b strings.Builder
197+ fmt .Fprint (& b , comment .AuthorLogin ())
198+ if comment .Association () != "NONE" {
199+ fmt .Fprintf (& b , " (%s)" , strings .Title (strings .ToLower (comment .Association ())))
200+ }
201+ fmt .Fprintf (& b , " • This comment has been marked as %s\n \n " , comment .HiddenReason ())
202+ return b .String ()
203+ }
0 commit comments