-
Notifications
You must be signed in to change notification settings - Fork 405
Show committer avatar as well as author in the PR commit view #876
Conversation
Basic rendering of the committer of the commits in the PR view. We only render if `authoredByCommitter` isn't true
We now only show committer only if it's not GitHub (noreply@github.com), which happens when you commit on GitHub
I can't see why Travis is failing here. However, everything is OK in my fork Travis test result |
Switched to a table layout so that the avatars line up. Example: Here another PR to test: atom/atom#13453
My commit seemed to fix it, but the failing was probably unrelated. |
@simurai I was trying to do the same locally, but I wouldn't make it perfect like your work, good CSS lesson ;)
Good to know, thanks |
@simurai Oops, looks like we broke something, just noticed it when testing against atom/atom#13453 I will fix it this time 😄 |
Yeah, apologies about the Travis failure. We have some flakey tests. We can restart the failing job for you if needed Thanks for taking this on :) |
I would like to add some tests for I tried this code (after I dug into describe('CommitContainer', function() {
it('renders a header with one user name', function() {
const item = {
author: {name: 'FirstName', avatarUrl: '', user: {login: 'FirstLogin'}},
committer: {name: 'GitHub', avatarUrl: '', user: null},
authoredByCommitter: true,
oid: 'xxx',
messageHeadline: ':smile: it\'s fun',
messageHeadlineHTML: 'fake html',
};
const app = <Commit item={item} />;
const instance = shallow(app);
assert.match(instance.text(), /FirstLogin/);
});
}); But the assertion fails with:
Any hint ? It's my first time to play with Relay and Enzyme |
Not technically part of this PR, sorry. 😇
Ping @kuychaco :) |
Sorry I haven't had a chance to dig into this — first day back after a holiday in the US.
I don't know if it's relevant to your failure or not, but the containers are responsible for reaching into the Relay store and such to fetch data from GraphQL. It's likely we'll want to separately export the non-containerized React component and test that directly instead. |
Oh, my bad I meant Commit component.
Isn't it already done in Commits component @BinaryMuse? Actually, I was trying to do the same with the Commit component. I think I will give it another shot and see if I can manage it to work Thanks |
@ahmed-taj Ah I see, I'm sorry for the misinformation. In the example you posted above, For example, to ensure that there's an image with the title attribute 'FirstLogin', you could use:
|
I think it's ready for review now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic job on this! The tests look ✨. Thank you so much for your contribution!
} | ||
if (commit.committer.name === 'GitHub' && commit.committer.user === null) { | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I actually had no clue this was how it worked.
I dug into the GItHub.com source code a bit and found that the committer name will be "GitHub Enterprise"
if we're running on GitHub enterprise. The noreply address is also based off the domain of the Enterprise install. I'm going to see if I can get a field added called authoredViaWeb
or something that matches the internal check we do, but until then this works great. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to see if I can get a field added called authoredViaWeb or something that matches the internal check we do
This would be perfect 👍
Fixes #774
Todo list