@@ -21,7 +21,6 @@ struct ConcernData {
21
21
#[ derive( Debug , PartialEq , Eq , Clone , serde:: Serialize , serde:: Deserialize ) ]
22
22
struct Concern {
23
23
title : String ,
24
- author : String ,
25
24
comment_url : String ,
26
25
status : ConcernStatus ,
27
26
}
@@ -44,7 +43,6 @@ pub(super) async fn handle_command(
44
43
let Some ( comment_url) = event. html_url ( ) else {
45
44
bail ! ( "unable to retrieve the comment url" )
46
45
} ;
47
- let author = event. user ( ) . login . to_owned ( ) ;
48
46
let issue = & issue_comment. issue ;
49
47
50
48
// Verify that this issue isn't a rfcbot FCP, skip if it is
@@ -100,7 +98,6 @@ pub(super) async fn handle_command(
100
98
{
101
99
concern_data. concerns . push ( Concern {
102
100
title,
103
- author,
104
101
status : ConcernStatus :: Active ,
105
102
comment_url : comment_url. to_string ( ) ,
106
103
} ) ;
@@ -165,38 +162,47 @@ fn markdown_content(concerns: &[Concern], bot: &str) -> String {
165
162
return "" . to_string ( ) ;
166
163
}
167
164
165
+ let active_concerns = concerns
166
+ . iter ( )
167
+ . filter ( |c| matches ! ( c. status, ConcernStatus :: Active ) )
168
+ . count ( ) ;
169
+
168
170
let mut md = String :: new ( ) ;
169
171
170
- let _ = writeln ! ( md, "\n # Concerns" ) ;
171
172
let _ = writeln ! ( md, "" ) ;
172
173
174
+ if active_concerns > 0 {
175
+ let _ = writeln ! ( md, "> [!CAUTION]" ) ;
176
+ } else {
177
+ let _ = writeln ! ( md, "> [!NOTE]" ) ;
178
+ }
179
+
180
+ let _ = writeln ! ( md, "> # Concerns ({active_concerns} active)" ) ;
181
+ let _ = writeln ! ( md, ">" ) ;
182
+
173
183
for & Concern {
174
184
ref title,
175
- ref author,
176
185
ref status,
177
186
ref comment_url,
178
187
} in concerns
179
188
{
180
189
let _ = match status {
181
190
ConcernStatus :: Active => {
182
- writeln ! (
183
- md,
184
- " - [{title}]({comment_url}) by [{author}](https://github.com/{author})"
185
- )
191
+ writeln ! ( md, "> - [{title}]({comment_url})" )
186
192
}
187
193
ConcernStatus :: Resolved {
188
194
comment_url : resolved_comment_url,
189
195
} => {
190
196
writeln ! (
191
197
md,
192
- " - ~~[{title}]({comment_url}) by [{author}](https://github.com/{author })~~ resolved [in this comment]({resolved_comment_url})"
198
+ "> - ~~[{title}]({comment_url})~~ resolved [in this comment]({resolved_comment_url})"
193
199
)
194
200
}
195
201
} ;
196
202
}
197
203
198
- let _ = writeln ! ( md, "" ) ;
199
- let _ = writeln ! ( md, "*Managed by `@{bot}`—see [help](https://forge.rust-lang.org/triagebot/concern.html) for details.*" ) ;
204
+ let _ = writeln ! ( md, "> " ) ;
205
+ let _ = writeln ! ( md, "> *Managed by `@{bot}`—see [help](https://forge.rust-lang.org/triagebot/concern.html) for details.*" ) ;
200
206
201
207
md
202
208
}
@@ -206,13 +212,11 @@ fn simple_markdown_content() {
206
212
let concerns = & [
207
213
Concern {
208
214
title : "This is my concern about concern" . to_string ( ) ,
209
- author : "Urgau" . to_string ( ) ,
210
215
status : ConcernStatus :: Active ,
211
216
comment_url : "https://github.com/fake-comment-1234" . to_string ( ) ,
212
217
} ,
213
218
Concern {
214
219
title : "This is a resolved concern" . to_string ( ) ,
215
- author : "Kobzol" . to_string ( ) ,
216
220
status : ConcernStatus :: Resolved {
217
221
comment_url : "https:://github.com/fake-comment-8888" . to_string ( ) ,
218
222
} ,
@@ -223,12 +227,36 @@ fn simple_markdown_content() {
223
227
assert_eq ! (
224
228
markdown_content( concerns, "rustbot" ) ,
225
229
r#"
226
- # Concerns
230
+ > [!CAUTION]
231
+ > # Concerns (1 active)
232
+ >
233
+ > - [This is my concern about concern](https://github.com/fake-comment-1234)
234
+ > - ~~[This is a resolved concern](https://github.com/fake-comment-4561)~~ resolved [in this comment](https:://github.com/fake-comment-8888)
235
+ >
236
+ > *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/concern.html) for details.*
237
+ "#
238
+ ) ;
239
+ }
227
240
228
- - [This is my concern about concern](https://github.com/fake-comment-1234) by [Urgau](https://github.com/Urgau)
229
- - ~~[This is a resolved concern](https://github.com/fake-comment-4561) by [Kobzol](https://github.com/Kobzol)~~ resolved [in this comment](https:://github.com/fake-comment-8888)
241
+ #[ test]
242
+ fn resolved_concerns_markdown_content ( ) {
243
+ let concerns = & [ Concern {
244
+ title : "This is a resolved concern" . to_string ( ) ,
245
+ status : ConcernStatus :: Resolved {
246
+ comment_url : "https:://github.com/fake-comment-8888" . to_string ( ) ,
247
+ } ,
248
+ comment_url : "https://github.com/fake-comment-4561" . to_string ( ) ,
249
+ } ] ;
230
250
231
- *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/concern.html) for details.*
251
+ assert_eq ! (
252
+ markdown_content( concerns, "rustbot" ) ,
253
+ r#"
254
+ > [!NOTE]
255
+ > # Concerns (0 active)
256
+ >
257
+ > - ~~[This is a resolved concern](https://github.com/fake-comment-4561)~~ resolved [in this comment](https:://github.com/fake-comment-8888)
258
+ >
259
+ > *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/concern.html) for details.*
232
260
"#
233
261
) ;
234
262
}
0 commit comments