@@ -34,6 +34,10 @@ class FailureSummaryTab extends React.Component {
34
34
35
35
componentDidMount ( ) {
36
36
this . loadBugSuggestions ( ) ;
37
+
38
+ window . addEventListener ( thEvents . internalIssueClassification , ( event ) =>
39
+ this . checkInternalFailureOccurrences ( event . detail . internalBugId ) ,
40
+ ) ;
37
41
}
38
42
39
43
componentDidUpdate ( prevProps ) {
@@ -89,20 +93,16 @@ class FailureSummaryTab extends React.Component {
89
93
window . open ( data . url ) ;
90
94
} ;
91
95
92
- internalIssueFilerCallback = async ( data ) => {
93
- const { addBug } = this . props ;
96
+ checkInternalFailureOccurrences = ( bugInternalId ) => {
97
+ // Try matching an internal bug already fetched with enough occurences
94
98
const { suggestion, suggestions } = this . state ;
95
99
96
- await addBug ( { ...data , newBug : `i${ data . internal_id } ` } ) ;
97
- window . dispatchEvent ( new CustomEvent ( thEvents . saveClassification ) ) ;
98
-
99
- // Try matching an internal bug already fetched with enough occurences
100
100
const internalBugs = suggestions
101
101
. map ( ( s ) => s . bugs . open_recent )
102
102
. flat ( )
103
103
. filter ( ( bug ) => bug . id === null ) ;
104
104
const existingBug = internalBugs . filter (
105
- ( bug ) => bug . internal_id === data . internal_id ,
105
+ ( bug ) => bug . internal_id === bugInternalId ,
106
106
) [ 0 ] ;
107
107
// Check if we reached the required number of occurrence to open a bug in Bugzilla
108
108
if (
@@ -114,6 +114,15 @@ class FailureSummaryTab extends React.Component {
114
114
}
115
115
} ;
116
116
117
+ internalIssueFilerCallback = async ( data ) => {
118
+ const { addBug } = this . props ;
119
+
120
+ await addBug ( { ...data , newBug : `i${ data . internal_id } ` } ) ;
121
+ window . dispatchEvent ( new CustomEvent ( thEvents . saveClassification ) ) ;
122
+
123
+ this . checkInternalFailureOccurrences ( data . internal_id ) ;
124
+ } ;
125
+
117
126
loadBugSuggestions = ( ) => {
118
127
const { selectedJob } = this . props ;
119
128
0 commit comments