Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle ghost users (deleted accounts) #2100

Merged
merged 31 commits into from May 1, 2019

Conversation

Projects
2 participants
@kuychaco
Copy link
Member

commented Apr 25, 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

This PR introduces changes to handle ghost users throughout our UI. When a user account has been deleted, activity by them is replaced to be a "Deleted user" account -- https://github.com/ghost

Prior to this change, users were seeing errors thrown when looking up properties on a null user.

To address this, I created a GHOST_USER object in our lib/helpers.js file and used it throughout the codebase when we'd get back null from the GitHub graphql API.

export const GHOST_USER = {
  login: 'ghost',
  avatarUrl: 'https://avatars1.githubusercontent.com/u/10137?v=4',
  url: 'https://github.com/ghost',
};

Screenshot/Gif

N/A

Alternate Designs

N/A

Benefits

No more errors!

Possible Drawbacks

None.

Applicable Issues

Fixes #2014
Fixes #1921

Metrics

N/A

Tests

TODO

Documentation

N/A

Release Notes

Handle ghost users (deleted accounts) throughout the GitHub integration UI

User Experience Research (Optional)

N/A

@kuychaco kuychaco self-assigned this Apr 25, 2019

@kuychaco kuychaco added this to In progress in Sprint : 4 April 2019 - 8 May 2019 : v0.29.0 via automation Apr 25, 2019

@kuychaco kuychaco changed the title Ku handle ghost users Handle ghost users Apr 25, 2019

@kuychaco kuychaco changed the title Handle ghost users Handle ghost users (deleted accounts) Apr 25, 2019

@codecov

This comment has been minimized.

Copy link

commented Apr 26, 2019

Codecov Report

Merging #2100 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2100      +/-   ##
==========================================
+ Coverage   92.59%   92.65%   +0.05%     
==========================================
  Files         207      207              
  Lines       12036    12045       +9     
  Branches     1755     1764       +9     
==========================================
+ Hits        11145    11160      +15     
+ Misses        891      885       -6
Impacted Files Coverage Δ
...ainers/accumulators/review-comments-accumulator.js 100% <ø> (ø) ⬆️
lib/controllers/issueish-list-controller.js 100% <ø> (ø) ⬆️
...iners/accumulators/review-summaries-accumulator.js 100% <ø> (ø) ⬆️
lib/views/reviews-view.js 83.23% <100%> (ø) ⬆️
lib/helpers.js 90% <100%> (+0.04%) ⬆️
lib/views/timeline-items/commit-comment-view.js 100% <100%> (ø) ⬆️
lib/views/timeline-items/issue-comment-view.js 100% <100%> (ø) ⬆️
lib/containers/issueish-tooltip-container.js 100% <100%> (+85.71%) ⬆️
lib/models/issueish.js 83.78% <100%> (+0.45%) ⬆️
lib/views/pr-detail-view.js 100% <100%> (ø) ⬆️
... and 1 more

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 cf10092...5005ecb. Read the comment docs.

kuychaco and others added some commits Apr 29, 2019

Focus test mysteriously failing on CI
... and not locally 🤔
Don't modify an object that is passed to components as props
React (and Relay) discourage you from modifying objects that are passed 
to components as props: 
https://reactjs.org/docs/components-and-props.html#props-are-read-only. 
The "data" passed to the Issueish constructor is sent directly from the 
props passed to IssueishListController, so we should treat them as 
immutable.

I thought that React froze objects passed as props in development mode 
to catch these issues. That's what's failing on CI - I have no idea why 
it isn't failing locally for us.

smashwilson added some commits May 1, 2019

@kuychaco kuychaco marked this pull request as ready for review May 1, 2019

@kuychaco kuychaco requested a review from smashwilson May 1, 2019

@smashwilson
Copy link
Member

left a comment

A few random comments, no blockers. Thanks for taking care of this! It annoyed the hell out of me every time I did anything in find-and-replace 😆

@@ -67,6 +67,7 @@ export default createPaginationContainer(BareReviewCommentsAccumulator, {
author {
avatarUrl
login
url

This comment has been minimized.

Copy link
@smashwilson

smashwilson May 1, 2019

Member

Oh interesting, we were just URL-hacking this in before? Yeah, much cleaner to get it from GraphQL 👍

@@ -18,7 +18,7 @@ export const IssueBuilder = createSpecBuilderClass('Issue', {
number: {default: 123},
state: {default: 'OPEN'},
bodyHTML: {default: '<h1>HI</h1>'},
author: {linked: UserBuilder},
author: {linked: UserBuilder, default: null},

This comment has been minimized.

Copy link
@smashwilson

smashwilson May 1, 2019

Member

I really like defaulting these to null in the builder. This way we'll catch anywhere that an author is fetched from GraphQL but we don't account for it being nullable 👍

@@ -32,7 +32,7 @@ export const CommitBuilder = createSpecBuilderClass('Commit', {

export const CommitCommentBuilder = createSpecBuilderClass('CommitComment', {
id: {default: nextID},
author: {linked: UserBuilder},
author: {linked: UserBuilder, default: null},

This comment has been minimized.

Copy link
@smashwilson

smashwilson May 1, 2019

Member

You could add nullable: true here too. All that really does is let you use the .nullAuthor() function on the generated builder, though, which is functionally equivalent to .author(null).

@@ -61,7 +61,7 @@ export const HeadRefForcePushedEventBuilder = createSpecBuilderClass('HeadRefFor
}, 'Node');

export const IssueCommentBuilder = createSpecBuilderClass('IssueComment', {
author: {linked: UserBuilder},
author: {linked: UserBuilder, default: null},

This comment has been minimized.

Copy link
@smashwilson

smashwilson May 1, 2019

Member

Same here ☝️

@@ -6,6 +6,7 @@ export function createCommitComment(opts = {}) {
const o = {
id: idGen.generate('comment-comment'),
commitOid: '1234abcd',
includeAuthor: true,

This comment has been minimized.

Copy link
@smashwilson

smashwilson May 1, 2019

Member

I've been trying to phase out these test/fixtures/factories methods in favor of GraphQL builders - the GraphQL builders are easier to write against (the builder structure maps directly to the query!) and they keep up with changes to our queries and the schema. It's tedious as hell, though, so I don't blame you for patching this in 😛

Add `nullable: true` for builder fields where default value is null
Co-Authored-By: Ash Wilson <smashwilson@gmail.com>

@kuychaco kuychaco merged commit 9b569d0 into master May 1, 2019

14 checks passed

atom.github Build #20190501.22 succeeded
Details
atom.github (Lint) Lint succeeded
Details
atom.github (Linux beta) Linux beta succeeded
Details
atom.github (Linux dev) Linux dev succeeded
Details
atom.github (Linux stable) Linux stable succeeded
Details
atom.github (MacOS beta) MacOS beta succeeded
Details
atom.github (MacOS dev) MacOS dev succeeded
Details
atom.github (MacOS stable) MacOS stable succeeded
Details
atom.github (Snapshot) Snapshot succeeded
Details
atom.github (Windows beta) Windows beta succeeded
Details
atom.github (Windows dev) Windows dev succeeded
Details
atom.github (Windows stable) Windows stable succeeded
Details
codecov/patch 100% of diff hit (target 92.59%)
Details
codecov/project 92.65% (+0.05%) compared to cf10092
Details

Sprint : 4 April 2019 - 8 May 2019 : v0.29.0 automation moved this from In progress to Merged May 1, 2019

@kuychaco kuychaco deleted the ku-handle-ghost-users branch May 1, 2019

smashwilson added a commit that referenced this pull request May 8, 2019

Merge pull request #2100 from atom/ku-handle-ghost-users
Handle ghost users (deleted accounts)

This was referenced May 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.