@@ -11,6 +11,29 @@ use crate::app::{screens::details_actions::PatchsetAction, App};
11
11
fn render_details_and_actions ( f : & mut Frame , app : & App , details_chunk : Rect , actions_chunk : Rect ) {
12
12
let patchset_details_and_actions = app. patchset_details_and_actions_state . as_ref ( ) . unwrap ( ) ;
13
13
14
+ let mut patches_to_reply = String :: new ( ) ;
15
+ if let Some ( true ) = patchset_details_and_actions
16
+ . patchset_actions
17
+ . get ( & PatchsetAction :: ReplyWithReviewedBy )
18
+ {
19
+ patches_to_reply. push ( '(' ) ;
20
+ let number_offset = if patchset_details_and_actions. has_cover_letter {
21
+ 0
22
+ } else {
23
+ 1
24
+ } ;
25
+ let patches_to_reply_numbers: Vec < usize > = patchset_details_and_actions
26
+ . patches_to_reply
27
+ . iter ( )
28
+ . enumerate ( )
29
+ . filter_map ( |( i, & val) | if val { Some ( i + number_offset) } else { None } )
30
+ . collect ( ) ;
31
+ for number in patches_to_reply_numbers {
32
+ patches_to_reply. push_str ( & format ! ( "{number}," ) ) ;
33
+ }
34
+ patches_to_reply = format ! ( "{})" , & patches_to_reply[ ..patches_to_reply. len( ) - 1 ] ) ;
35
+ }
36
+
14
37
let patchset_details = & patchset_details_and_actions. representative_patch ;
15
38
let patchset_details = vec ! [
16
39
Line :: from( vec![
@@ -48,6 +71,14 @@ fn render_details_and_actions(f: &mut Frame, app: &App, details_chunk: Rect, act
48
71
Style :: default ( ) . fg( Color :: White ) ,
49
72
) ,
50
73
] ) ,
74
+ if !patches_to_reply. is_empty( ) {
75
+ Line :: from( vec![
76
+ Span :: styled( "Reviewed-by*: " , Style :: default ( ) . fg( Color :: Cyan ) ) ,
77
+ Span :: styled( patches_to_reply, Style :: default ( ) . fg( Color :: DarkGray ) ) ,
78
+ ] )
79
+ } else {
80
+ Line :: from( Span :: default ( ) )
81
+ } ,
51
82
] ;
52
83
53
84
let patchset_details = Paragraph :: new ( patchset_details)
@@ -81,8 +112,9 @@ fn render_details_and_actions(f: &mut Frame, app: &App, details_chunk: Rect, act
81
112
Span :: styled( "ookmark" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
82
113
] ) ,
83
114
Line :: from( vec![
84
- if * patchset_actions
85
- . get( & PatchsetAction :: ReplyWithReviewedBy )
115
+ if * patchset_details_and_actions
116
+ . patches_to_reply
117
+ . get( patchset_details_and_actions. preview_index)
86
118
. unwrap( )
87
119
{
88
120
Span :: styled( "[x] " , Style :: default ( ) . fg( Color :: Green ) )
@@ -96,7 +128,7 @@ fn render_details_and_actions(f: &mut Frame, app: &App, details_chunk: Rect, act
96
128
. add_modifier( Modifier :: UNDERLINED )
97
129
. add_modifier( Modifier :: BOLD ) ,
98
130
) ,
99
- Span :: styled( "eviewed-by" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
131
+ Span :: styled( "eviewed-by " , Style :: default ( ) . fg( Color :: Cyan ) ) ,
100
132
] ) ,
101
133
] ;
102
134
let patchset_actions = Paragraph :: new ( patchset_actions)
@@ -122,10 +154,17 @@ fn render_preview(f: &mut Frame, app: &App, chunk: Rect) {
122
154
. message_id ( )
123
155
. href ;
124
156
let mut preview_title = String :: from ( " Preview " ) ;
125
- if let Some ( successful_indexes) = app. reviewed_patchsets . get ( representative_patch_message_id) {
126
- if successful_indexes. contains ( & preview_index) {
127
- preview_title = " Preview [REVIEWED] " . to_string ( ) ;
128
- }
157
+ if matches ! (
158
+ app. reviewed_patchsets. get( representative_patch_message_id) ,
159
+ Some ( successful_indexes) if successful_indexes. contains( & preview_index)
160
+ ) {
161
+ preview_title = " Preview [REVIEWED-BY] " . to_string ( ) ;
162
+ } else if * patchset_details_and_actions
163
+ . patches_to_reply
164
+ . get ( preview_index)
165
+ . unwrap ( )
166
+ {
167
+ preview_title = " Preview [REVIEWED-BY]* " . to_string ( ) ;
129
168
} ;
130
169
131
170
let preview_offset = patchset_details_and_actions. preview_scroll_offset ;
0 commit comments