18 lines
700 B
JavaScript
18 lines
700 B
JavaScript
import { isEmpty } from '@ember/utils';
|
|
|
|
//
|
|
// Derives a stable grouping key for a contribution, so that contributions
|
|
// created for the same issue/pull request (one per contributor) can be
|
|
// linked together in the UI.
|
|
//
|
|
// The bot writes the exact same `url` string (the html_url of the issue/PR)
|
|
// into every per-contributor IPFS document for a given piece of work, so the
|
|
// top-level `url` field on the model is sufficient as a grouping key. Manual
|
|
// contributions without a URL return null and are treated as singletons.
|
|
//
|
|
export default function contributionGroupingKey (contribution) {
|
|
let url = contribution ? contribution.url : null;
|
|
if (isEmpty(url)) return null;
|
|
return url;
|
|
}
|