This repository was archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Display default avatar for avatars from enterprise hosts. #1873
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nit: I find the new
if (model?.AvatarUrl is string avatarUrl)syntax more readable.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.
Interesting, what do you find more readable about that? I use the new syntax a lot, but only when a cast is involved.
AvatarUrlis already typed to string so there is no cast, and so it's just a comparison with null...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 just find that it reads well in my head: "if
model?.AvatarUrlis astringthen call itavatarUrland do stuff with it".Maybe I'm a little over obsessive about putting things in variables. Previously I'd have been inclined to do:
I'm now happy with the conciseness and expressiveness of
if (model?.AvatarUrl is string avatarUrl). I know you can also doif (model?.AvatarUrl is var avatarUrl), butis varlooks a little strange to me.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.
Yeah, I dunno... The problem for me with "if model?.AvatarUrl is a string then call it avatarUrl and do stuff with it" is that it's always a string. That pattern should be used for casting IMO, not just checking for null, and it surprises me when there isn't actually a cast.
Uh oh!
There was an error while loading. Please reload this page.
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.
Do you think
if (model?.AvatarUrl is var avatarUrl)is any better because it's more obvious thatis varisn't a cast?