@@ -267,97 +267,114 @@ export class AppBuildDetailsComponent implements OnInit, OnDestroy {
267267 data . commits && data . commits [ data . commits . length - 1 ] && data . commits [ data . commits . length - 1 ] . timestamp ||
268268 null ;
269269
270- if ( this . build . data . commit ) {
271- this . commitMessage = this . build . data . commit . message ;
272- } else if ( this . build . data . commits ) {
273- const len = this . build . data . commits . length - 1 ;
274- this . commitMessage = this . build . data . commits [ len ] . message ;
275- } else if ( this . build . data . pull_request && this . build . data . pull_request . title ) {
276- this . commitMessage = this . build . data . pull_request . title ;
277- } else if ( this . build . data . head_commit ) {
278- this . commitMessage = this . build . data . head_commit . message ;
279- }
270+ if ( this . build . repository . repository_provider === 'github' ) {
271+ if ( this . build . data . commit ) {
272+ this . commitMessage = this . build . data . commit . message ;
273+ } else if ( this . build . data . commits ) {
274+ const len = this . build . data . commits . length - 1 ;
275+ this . commitMessage = this . build . data . commits [ len ] . message ;
276+ } else if ( this . build . data . pull_request && this . build . data . pull_request . title ) {
277+ this . commitMessage = this . build . data . pull_request . title ;
278+ } else if ( this . build . data . head_commit ) {
279+ this . commitMessage = this . build . data . head_commit . message ;
280+ }
281+
282+ if ( this . build . data . sha ) {
283+ const data = this . build . data ;
284+ this . committerAvatar = data . committer . avatar_url ;
285+ this . nameCommitter = data . commit . committer . name ;
286+ this . authorAvatar = data . author . avatar_url ;
287+ this . nameAuthor = data . commit . author . name ;
288+ } else if ( this . build . data . head_commit ) {
289+ const commit = this . build . data . head_commit ;
290+ this . committerAvatar = this . build . data . sender . avatar_url ;
291+ this . nameCommitter = this . build . data . head_commit . author . name ;
292+
293+ if ( commit . author . username !== commit . committer . username ) {
294+ this . nameCommitter = commit . committer . name ;
295+
296+ this . apiService . getGithubUserData ( commit . author . username ) . subscribe ( ( evt : any ) => {
297+ if ( evt . status === 200 ) {
298+ const body = JSON . parse ( evt . _body ) ;
299+ this . authorAvatar = body . avatar_url ;
300+ }
301+ } ) ;
302+ } else {
303+ this . authorAvatar = this . committerAvatar ;
304+ this . nameCommitter = this . nameAuthor ;
305+ }
306+ } else if ( this . build . data . pull_request ) {
307+ this . authorAvatar = this . build . data . sender . avatar_url ;
308+ this . committerAvatar = this . authorAvatar ;
280309
281- if ( this . build . data . sha ) {
282- const data = this . build . data ;
283- this . committerAvatar = data . committer . avatar_url ;
284- this . nameCommitter = data . commit . committer . name ;
285- this . authorAvatar = data . author . avatar_url ;
286- this . nameAuthor = data . commit . author . name ;
287- } else if ( this . build . data . head_commit ) {
288- const commit = this . build . data . head_commit ;
289- this . committerAvatar = this . build . data . sender . avatar_url ;
290- this . nameCommitter = this . build . data . head_commit . author . name ;
291-
292- if ( commit . author . username !== commit . committer . username ) {
293- this . nameCommitter = commit . committer . name ;
294-
295- this . apiService . getGithubUserData ( commit . author . username ) . subscribe ( ( evt : any ) => {
310+ this . apiService . getGithubUserData ( this . build . data . sender . login ) . subscribe ( ( evt : any ) => {
296311 if ( evt . status === 200 ) {
297312 const body = JSON . parse ( evt . _body ) ;
298- this . authorAvatar = body . avatar_url ;
313+ this . nameAuthor = body . name ;
299314 }
300315 } ) ;
301- } else {
302- this . authorAvatar = this . committerAvatar ;
303- this . nameCommitter = this . nameAuthor ;
304- }
305- } else if ( this . build . data . pull_request ) {
306- this . authorAvatar = this . build . data . sender . avatar_url ;
307- this . committerAvatar = this . authorAvatar ;
308-
309- this . apiService . getGithubUserData ( this . build . data . sender . login ) . subscribe ( ( evt : any ) => {
310- if ( evt . status === 200 ) {
311- const body = JSON . parse ( evt . _body ) ;
312- this . nameAuthor = body . name ;
313- }
314- } ) ;
315316
316- this . apiService . getGithubUserData ( this . build . data . pull_request . user . login ) . subscribe ( ( evt : any ) => {
317- if ( evt . status === 200 ) {
318- const body = JSON . parse ( evt . _body ) ;
319- this . nameCommitter = body . name ;
320- }
321- } ) ;
322- }
323-
324- // bitbucket
325- if ( this . build . data . actor ) {
326- this . authorAvatar = this . build . data . actor . links . avatar . href ;
327- this . nameAuthor = this . build . data . actor . display_name ;
328- }
329-
330- if ( this . build . data . push ) {
331- this . commitMessage = this . build . data . push . changes [ 0 ] . commits [ 0 ] . message ;
332- this . dateTime = this . build . data . push . changes [ 0 ] . commits [ 0 ] . date ;
333- this . committerAvatar = this . build . data . push . changes [ 0 ] . commits [ 0 ] . author . user . links . avatar . href ;
334- this . nameCommitter = this . build . data . push . changes [ 0 ] . commits [ 0 ] . author . user . display_name ;
335- } else if ( this . build . data . pullrequest ) {
336- this . commitMessage = data . pullrequest . description ;
337- this . dateTime = data . pullrequest . updated_on ;
338- this . committerAvatar = data . pullrequest . author . links . avatar . href ;
339- this . nameAuthor = data . pullrequest . author . display_name ;
340- this . nameCommitter = this . nameAuthor ;
341- }
317+ this . apiService . getGithubUserData ( this . build . data . pull_request . user . login ) . subscribe ( ( evt : any ) => {
318+ if ( evt . status === 200 ) {
319+ const body = JSON . parse ( evt . _body ) ;
320+ this . nameCommitter = body . name ;
321+ }
322+ } ) ;
323+ }
324+ } else if ( this . build . repository . repository_provider === 'bitbucket' ) {
325+ // bitbucket
326+ if ( this . build . data . actor ) {
327+ this . authorAvatar = this . build . data . actor . links . avatar . href ;
328+ this . nameAuthor = this . build . data . actor . display_name ;
329+ }
342330
343- // gitlab
344- if ( data . user_avatar ) {
345- this . authorAvatar = data . user_avatar ;
346- this . commitMessage = data . commits [ 0 ] . message ;
347- this . dateTime = data . commits [ 0 ] . timestamp ;
348- this . committerAvatar = this . authorAvatar ;
349- this . nameAuthor = data . user_name ;
350- this . nameCommitter = data . commits [ 0 ] . author . name ;
351- }
331+ if ( this . build . data . push ) {
332+ this . commitMessage = this . build . data . push . changes [ 0 ] . commits [ 0 ] . message ;
333+ this . dateTime = this . build . data . push . changes [ 0 ] . commits [ 0 ] . date ;
334+ this . committerAvatar = this . build . data . push . changes [ 0 ] . commits [ 0 ] . author . user . links . avatar . href ;
335+ this . nameCommitter = this . build . data . push . changes [ 0 ] . commits [ 0 ] . author . user . display_name ;
336+ } else if ( this . build . data . pullrequest ) {
337+ this . commitMessage = data . pullrequest . description ;
338+ this . dateTime = data . pullrequest . updated_on ;
339+ this . committerAvatar = data . pullrequest . author . links . avatar . href ;
340+ this . nameAuthor = data . pullrequest . author . display_name ;
341+ this . nameCommitter = this . nameAuthor ;
342+ }
343+ } else if ( this . build . repository . repository_provider === 'gitlab' ) {
344+ // gitlab
345+ if ( data . user_avatar ) {
346+ this . authorAvatar = data . user_avatar ;
347+ this . commitMessage = data . commits [ 0 ] . message ;
348+ this . dateTime = data . commits [ 0 ] . timestamp ;
349+ this . committerAvatar = this . authorAvatar ;
350+ this . nameAuthor = data . user_name ;
351+ this . nameCommitter = data . commits [ 0 ] . author . name ;
352+ } else if ( data . object_attributes ) {
353+ this . authorAvatar = data . user . avatar_url ;
354+ this . commitMessage = data . object_attributes . last_commit . message ;
355+ this . dateTime = data . object_attributes . last_commit . timestamp ;
356+ this . committerAvatar = this . authorAvatar ;
357+ this . nameAuthor = data . user . name ;
358+ this . nameCommitter = data . object_attributes . last_commit . author . name ;
359+ }
360+ } else if ( this . build . repository . repository_provider === 'gogs' ) {
361+ // gogs
362+ if ( data . pusher ) {
363+ this . authorAvatar = data . pusher . avatar_url ;
364+ this . nameAuthor = data . pusher . username ;
365+ }
352366
353- // gogs
354- if ( data . sender && data . pusher ) {
355- this . authorAvatar = data . pusher . avatar_url ;
356- this . nameAuthor = data . pusher . username ;
357- this . commitMessage = data . commits [ 0 ] . message ;
358- this . dateTime = data . commits [ 0 ] . timestamp ;
359- this . committerAvatar = data . sender . avatar_url ;
360- this . nameCommitter = data . sender . username ;
367+ if ( data . sender ) {
368+ this . commitMessage = data . commits [ 0 ] . message ;
369+ this . dateTime = data . commits [ 0 ] . timestamp ;
370+ this . committerAvatar = data . sender . avatar_url ;
371+ this . nameCommitter = data . sender . username ;
372+ } else if ( data . pull_request ) {
373+ this . authorAvatar = data . pull_request . user . avatar_url ;
374+ this . nameAuthor = data . pull_request . user . username ;
375+ this . commitMessage = data . pull_request . title ;
376+ this . dateTime = data . pull_request . head_repo . updated_at ;
377+ }
361378 }
362379
363380 this . timerSubscription = this . timeService . getCurrentTime ( ) . subscribe ( time => {
0 commit comments