Skip to content

Consider more positive reactions in highest-rated-comment - #2387

Merged
fregante merged 12 commits into
refined-github:masterfrom
CTrando:scratch/CountMultipleEmjoiHighestRatedComment
Sep 6, 2019
Merged

fregante merged 12 commits into
refined-github:masterfrom
CTrando:scratch/CountMultipleEmjoiHighestRatedComment

Conversation

@CTrando

@CTrando CTrando commented Aug 28, 2019

Copy link
Copy Markdown
Contributor

Closes #2190

Test

From original to make sure it still works:
leafo/sticky-kit#201
react/react#13991
flutter/flutter#11609
MrMEEE/bumblebee-Old-and-abbandoned#123
Example of likes vs hearts + likes (also my project 😃)
microsoft/python-language-server#19

@CTrando CTrando changed the title Scratch/count multiple emjoi highest rated comment Counting more emojis in getting top comment Aug 28, 2019
@CTrando CTrando changed the title Counting more emojis in getting top comment Counting more reactions in getting top comment Aug 28, 2019

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Untested but LGTM

@fregante fregante changed the title Counting more reactions in getting top comment Consider more positive reactions in highest-rated-comment Sep 2, 2019
@CTrando

CTrando commented Sep 3, 2019

Copy link
Copy Markdown
Contributor Author

Question, how come you swapped the default parameter for the null parameter and that or construct? I'm not too experienced with typescript but is there a difference?

@fregante

fregante commented Sep 3, 2019 •

Copy link
Copy Markdown
Member

(reactionBox = document) will set the type of reactionBox to Document but we need it to stay Element so the other calls will keep working; they were failing:

ERROR in ./source/features/highest-rated-comment.tsx(33,59):
TS2345: Argument of type 'Element' is not assignable to parameter of type 'Document'.

ERROR in ./source/features/highest-rated-comment.tsx(41,59):
TS2345: Argument of type 'Element' is not assignable to parameter of type 'Document'.

Instead of changing the type of the parameter, I thought it would be easier to just make it optional and then handle its absence later in the code (reactionBox || document)

@CTrando

CTrando commented Sep 4, 2019

Copy link
Copy Markdown
Contributor Author

Ah I see, sorry about that, I didn't see the compile errors but since it still ran I thought it was fine. Too used to static languages 😄 I'll test this out today or tomorrow and merge, thanks for the explanation.

@CTrando

CTrando commented Sep 6, 2019

Copy link
Copy Markdown
Contributor Author

I'll wait for another day just to be safe if you want to do anything, but I tested it out on the example cases and it works fine.

@fregante
fregante merged commit 84d0df7 into refined-github:master Sep 6, 2019
@fregante

fregante commented Sep 6, 2019

Copy link
Copy Markdown
Member

I tested it as well and it seems to work correctly

@nikoladev

Copy link
Copy Markdown

Thanks @CTrando!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Count more reactions when considering the highest rated comment

4 participants