File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -87,14 +87,23 @@ pub(super) async fn handle_command(
87
87
let edit = EditIssueBody :: new ( & issue, CONCERN_ISSUE_KEY ) ;
88
88
let mut concern_data: ConcernData = edit. current_data ( ) . unwrap_or_default ( ) ;
89
89
90
- // Process the command by either adding a new comment or "deactivating" the old one
90
+ // Process the command by either adding a new concern or resolving the old one
91
91
match cmd {
92
- ConcernCommand :: Concern { title } => concern_data. concerns . push ( Concern {
93
- title,
94
- author,
95
- status : ConcernStatus :: Active ,
96
- comment_url : comment_url. to_string ( ) ,
97
- } ) ,
92
+ ConcernCommand :: Concern { title } => {
93
+ // Only add a concern if it wasn't already added, we could be in an edit
94
+ if !concern_data
95
+ . concerns
96
+ . iter ( )
97
+ . any ( |c| c. title == title && c. comment_url == comment_url)
98
+ {
99
+ concern_data. concerns . push ( Concern {
100
+ title,
101
+ author,
102
+ status : ConcernStatus :: Active ,
103
+ comment_url : comment_url. to_string ( ) ,
104
+ } ) ;
105
+ }
106
+ }
98
107
ConcernCommand :: Resolve { title } => concern_data
99
108
. concerns
100
109
. iter_mut ( )
You can’t perform that action at this time.
0 commit comments