stumptown-content icon indicating copy to clipboard operation
stumptown-content copied to clipboard

Link to contributors in some other/better way

Open peterbe opened this issue 6 years ago • 3 comments

Please be aware of this discussion: https://github.com/mozilla/kuma/issues/5717 I think stumptown-renderer would equally benefit from not having to render that massive list of names and URLs.

This issue belongs both and either here and in stumptown-renderer but they're intertwined.

Content in stumptown will almost certainly "always" (at least of URIs that existed on the Wiki) be a mix of historical contributions from the Wiki as well as git commits within a directory.

We will have to port the contributions from the Wiki into stumptown-content. Like we've already done We can union this by doing some fancy git log commands [0] as time progresses the list of contributions will be a little bit of Wiki historical and a little bit git log.

One big question; if we take head from https://github.com/mozilla/kuma/issues/5717 , especially in point-of-view of stumptown-renderer, if you don't display the full list of names, where else do you display it?

[0] E.g.

git log -M --follow --pretty=tformat:"%aN %aE" -- content/html/reference/elements/video/docs.md | uniq

peterbe avatar Aug 28 '19 14:08 peterbe

From stumptown-renderer's point of view, my gut tells me that the ideal solution would that stumptown-content packages a list like this:

(e.g. packaged/html/reference/elements/video.json)

{
   "contributors": [
     {"github": "florian"},
     {"github": "peterbe", "full_name": "Peter Bengtsson"},
     {"legacy": "hellokitty93"},
     {"legacy": "someusername"}
   ],
  "last_modified_date": "SOME ISO DATE",
  "last_modified_by": {"github": "florian"},
}

Then, when rendering the page, we display...

Last updated: 23 Aug 2019 by <a href="https://github.com/florian">@florian</a> and <a href="#contributors" onClick="loadAllCotributors()">3 others</a>. 

Then, an XHR request would get the complete list and display all the names in a <ul> list. The key dictactes how to make a link (or not a link) out of it. For example:

contributors.map(contributor => {
  if (contributor.github) {
    return <a href={`https://github.com/${contributor.github}`}><i className="wiki-icon"> {contributor.full_name || contributor.github}</a>
  } else if (contributor.legacy) {
    return <b title="Contributor from when MDN was a Wiki"><i className="wiki-icon"/> {contributor.full_name || contributor.legacy}</b>
  }
  ...
})

peterbe avatar Aug 28 '19 14:08 peterbe

Note-to-self; I found some notes about how to get authors from a git repo. Here are some ideas And this is a good start:

▶ git log -M --follow --pretty=tformat:"%aN %aE" -- content/html/reference/elements/video/docs.md | uniq
Joe D'Arcangelo [email protected]
wbamberg [email protected]
Florian Scholz [email protected]
Will Bamberg [email protected]
wbamberg [email protected]
Will Bamberg [email protected]
rjohnson [email protected]
Florian Scholz [email protected]
Will Bamberg [email protected]
Florian Scholz [email protected]

Just need to figure out how the heck to map full names and emails down to GitHub usernames.

peterbe avatar Aug 28 '19 14:08 peterbe

Just need to figure out how the heck to map full names and emails down to GitHub usernames.

Yeah, my user is actually a rough test case for this as well because my username is joedarc. Might be able to use the GitHub API to retrieve the info you need?

GET /repos/:owner/:repo/commits?path=:path-to-file

joedarc avatar Sep 19 '19 21:09 joedarc