Repository navigation
Add tree links to issue timestamps - #741
Conversation
|
@jgierer12 Oh shoot, I didn't notice you assigned it to yourself and worked on it. I worked on this too 😬. What should I do now? |
|
I thought a lot and sent duplicate pull anyway mentioning the same. You can have a look. 😄 |
|
Thanks, sorry again! |
|
Design concepts I have so far:
|
|
I like option 3. Can you show it with more detail on how it would show on the page |
| if (pageDetect.isPR() || pageDetect.isIssue()) { | ||
| safely(linkifyIssuesInTitles); | ||
| observeEl('.new-discussion-timeline', addOPLabels, {childList: true, subtree: true}); | ||
| observeEl('.new-discussion-timeline', addTimestampTreeLinks, {childList: true, subtree: true}); |
There was a problem hiding this comment.
Since these are identical, can you merge them?
| return; | ||
| } | ||
|
|
||
| location.href = `https://github.com/${ownerName}/${repoName}/tree/${sha}`; |
There was a problem hiding this comment.
Drop protocol and hostname to support GHEnterprise
| const timestampValue = select('relative-time', timestampLink).attributes.datetime.value; | ||
|
|
||
| const openTree = async ({target}) => { | ||
| target.replaceChild(icons.clock(), target.firstChild); |
There was a problem hiding this comment.
All replaceChild instances can be replaced by firstChild.replaceWith
| export default async () => { | ||
| const newTimestamps = select.all(`.new-discussion-timeline .timestamp:not(.refined-github-comment-browse-files)`); | ||
|
|
||
| newTimestamps.forEach(async timestampLink => { |
There was a problem hiding this comment.
async is not needed here, this loop can be replaced with for of
| const {ownerName, repoName} = getOwnerAndRepo(); | ||
|
|
||
| const getSHABeforeTimestamp = async timestamp => { | ||
| const url = `https://api.github.com/repos/${ownerName}/${repoName}/commits?until=${timestamp}&per_page=1`; |
There was a problem hiding this comment.
If we’re positive we can’t do this without the API, we still need to support /api instead of the subdomain, for GHE. You might want to pack it up as a getApiUrl function because we’ll probably need the same logic again in the future.
It would match "edited" times and it would fail.
8c005f5 to
580e563
Compare
|
Note: if we settle for the |
95ed917 to
7041a9e
Compare
426c437 to
668182e
Compare
|
@bfred-it Can you fix the merge conflict? Is this PR done? |
|
Yep it's done |
| export default endpoint => { | ||
| const api = location.hostname === 'github.com' ? 'https://api.github.com/' : `${location.origin}/api/`; | ||
| return fetch(api + endpoint).then(res => res.json()); | ||
| }; |
There was a problem hiding this comment.
Currently, yes, but it's not being included at the moment. I feel it's a start for whenever the API materializes.
| padding: 0; | ||
| } | ||
| :root .rgh-timestamp-button .octicon { | ||
| vertical-align: sub; |
There was a problem hiding this comment.
I think this should be sub => middle. It looks slightly vertically unaligned now.
There was a problem hiding this comment.
Actually for some reason this isn't being applied at all so it defaults to middle (which isn't aligned)
There was a problem hiding this comment.
baseline is the default, not middle.
There was a problem hiding this comment.
When I manually applied middle in devtools it looked ok.
Created by @jgierer12 and @bfred-it
|
Great work @jgierer12 and @bfred-it. This is a very useful feature. And thanks for suggesting it @ianstormtaylor 👌 |
|
Just noticed this feature while looking through a giant PR at work, and was so excited when I saw it. Thanks for doing this! |









Fixes #732
@ianstormtaylor @sindresorhus is this what you had in mind functionality-wise?
This still needs a lot of work:
Currently making a few conceptsSee Add tree links to issue timestamps #741 (comment), Add tree links to issue timestamps #741 (comment)GitHub Enterprise support (cc @busches) andprivate repo support