Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Add author association to review summaries and thread comments #2085

Merged
merged 10 commits into from
Apr 24, 2019

Conversation

kuychaco
Copy link
Contributor

@kuychaco kuychaco commented Apr 18, 2019

Please be sure to read the contributor's guide to the GitHub package before submitting any pull requests.

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • Suggestion: You can use checklists to keep track of progress for the sections on metrics, tests, documentation, and user research.

Description of the Change

Our trusty Community and Safety team pointed out that displaying "first time contributor" badges encourages people to be kind to new folks, etc.

This PR introduces authorAssociation information provided by the GitHub GraphQL API to indicate the author's relationship to the repository (member, owner, collaborator, contributor, first-time contributor, first-timer, none). See API docs for more information.

Badges for author association are displayed on review summary comments as well as review thread comments.

See #2056 for reference.

Screenshot/Gif

Summaries:

Reviews__5_—___src_trepo

Review threads:

Reviews__5_—___src_trepo_and_Comparing_master___ku-add-author-association_·_atom_github

Alternate Designs

None were considered.

Benefits

Folks have more context about the author of the comments and can therefore adjust their responses accordingly. For example, responses to comments made by "First-time contributors" warrant extra thought and attention, to ensure that we are welcoming new contributors and effectively growing our communities -- https://github.blog/2017-07-25-making-it-easier-to-grow-communities-on-github/

Possible Drawbacks

There is limited space in comment headers. An additional badge adds some visual noise, and if the panel width isn't large enough, the badge appears on a separate line:

Reviews__5_—___src_trepo

Applicable Issues

#2056

Metrics

N/A

Tests

Added unit tests to ensure that text shows up correctly for each author association value (member, owner, collaborator, contributor, first-time contributor, first-timer, none). Did this for both review summary comments and thread comments.

Documentation

N/A

Release Notes

Add author association badges to GitHub review comments.

User Experience Research (Optional)

N/A

TODO: make summary badges drop to new line (as is the case for thread comments)

Reviews__5_—___src_trepo

@kuychaco kuychaco self-assigned this Apr 18, 2019
@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #2085 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2085      +/-   ##
==========================================
+ Coverage   92.55%   92.55%   +<.01%     
==========================================
  Files         207      207              
  Lines       12016    12021       +5     
  Branches     1745     1746       +1     
==========================================
+ Hits        11121    11126       +5     
  Misses        895      895
Impacted Files Coverage Δ
...ainers/accumulators/review-comments-accumulator.js 100% <ø> (ø) ⬆️
...iners/accumulators/review-summaries-accumulator.js 100% <ø> (ø) ⬆️
lib/views/reviews-view.js 83.23% <100%> (+0.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f98abf3...4a8615e. Read the comment docs.

Copy link

@annthurium annthurium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!! Thanks for taking this on.

@@ -113,6 +113,59 @@ describe('ReviewsView', function() {
assert.lengthOf(wrapper.find('details.github-Review'), 2);
});

it('displays an author association badge for review summaries', function() {
const {summaries, commentThreads} = aggregatedReviewsBuilder()
.addReviewSummary(r => r.id(0).authorAssociation('MEMBER'))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for being thorough and testing all the associations!

I really want you to not have to type all these things out manually. I wish it was possible to do something like...

const {summaries, commentThreads} = aggregatedReviewsBuilder();
let idx = 0;
Object.entries(authorAssociationText).forEach(([key, value]) => {
  addReviewSummary(r => r.id(idx).authorAssociation(value));
  idx ++;
});
summaries.build();
comments.build();

I don't think we can actually use the builders that way though.

I mean, you could create a new review and summary for each association and then test those. Since you already put in the effort to manually type all these out, not sure it's worth the time to optimize.

…line

Co-Authored-By: Tilde Ann Thurium <annthurium@github.com>
@kuychaco kuychaco marked this pull request as ready for review April 24, 2019 00:17
Copy link
Contributor

@vanessayuenn vanessayuenn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this!

@kuychaco kuychaco merged commit 4ef8aac into master Apr 24, 2019
@kuychaco kuychaco deleted the ku-add-author-association branch April 24, 2019 21:44
@smashwilson smashwilson mentioned this pull request May 8, 2019
11 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants