Skip to content

Commit

Permalink
Fix possible concurrency issue in contributor listing
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Jan 17, 2025
1 parent 416e5d0 commit fb4da47
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions _layouts/community/community-contributors.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ layout: community-standard
var contributorsNameMapping;
$.getJSON( "/community/contributors/contributors-name-mapping.json", function( data ) {
contributorsNameMapping = data;
});
$.getJSON( "https://api.github.com/repos/hibernate/#{project_description.github.project}/contributors", function( data ) {
var items = [];
data.forEach( function( contributor ) {
var contributorName = contributorsNameMapping ? (contributorsNameMapping[contributor.login] ? contributorsNameMapping[contributor.login] : contributor.login) : contributor.login;

items.push(
$( '<div class="ui card contributor"/>' )
.append( $( '<div class="image"/>' ).append( $('<img src="' + contributor.avatar_url + '" />' ) ) )
.append( $( '<div class="content" />' ).append( $( '<div class="header" />' ).append( $( '<a href="' + contributor.html_url + '" />' ).text( contributorName ) ) ) )
.append( $( '<div class="extra content" />' ).append( $( '<span class="right floated" />' ).text( contributor.contributions + ' commit' + ( contributor.contributions > 1 ? 's' : '' ) ) ) )
);
$.getJSON( "https://api.github.com/repos/hibernate/#{project_description.github.project}/contributors", function( data ) {
var items = [];
data.forEach( function( contributor ) {
var contributorName = contributorsNameMapping ? (contributorsNameMapping[contributor.login] ? contributorsNameMapping[contributor.login] : contributor.login) : contributor.login;

items.push(
$( '<div class="ui card contributor"/>' )
.append( $( '<div class="image"/>' ).append( $('<img src="' + contributor.avatar_url + '" />' ) ) )
.append( $( '<div class="content" />' ).append( $( '<div class="header" />' ).append( $( '<a href="' + contributor.html_url + '" />' ).text( contributorName ) ) ) )
.append( $( '<div class="extra content" />' ).append( $( '<span class="right floated" />' ).text( contributor.contributions + ' commit' + ( contributor.contributions > 1 ? 's' : '' ) ) ) )
);
});

$( '#contributor-list' ).append( items );
$( '#contributor-loader' ).hide();
$( '#contributor-list' ).fadeIn();
});

$( '#contributor-list' ).append( items );
$( '#contributor-loader' ).hide();
$( '#contributor-list' ).fadeIn();
});
});

0 comments on commit fb4da47

Please sign in to comment.