define('bitbucket/internal/build/status/status-panel-context-provider', [
    'bitbucket/internal/build/status/build-status',
    'bitbucket/internal/util/shortcuts',
    'exports'
], function (
    buildStatus,
    shortcuts,
    exports
) {

    var latestCommit;

    exports.fetchContext = function (ctx) {
        latestCommit = ctx.commitId;
        buildStatus.queryBuildStatusAndDecorate(
            ctx,
            '.build-status-placeholder',
            '.build-status-summary .build-status-overview-link, .build-status-summary .build-icon',
            bitbucket.internal.build.status.stats);
    };

    shortcuts.bind('showBuildDialog', function () {
        buildStatus.showDialogIfHasBuildStatus(latestCommit);
    });
});
