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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement like / dislike count #17

Closed
wants to merge 6 commits into from
Closed

Implement like / dislike count #17

wants to merge 6 commits into from

Conversation

SpaceK33z
Copy link
Contributor

Comments that contain only +1 or 馃憤 will be treated as a like. For dislike -1 and 馃憥.
The count of the likes / dislikes will be shown in the sidebar of an issue or PR, like this:

add_explicit_ _1 feature_for_issues_that_isn_t_a_comment issue__9 _isaacs_github

Fixes #15. In #15 I showed a screenshot that also shows user avatars; I've decided not to this for now (maybe later).

Personally I've no use for this feature, but I've much sympathy for huge open-source project maintainers and hope to help them :).

Comments that contain only `+1` or the +1 emoji, will be treated as a like. For dislike `-1` and -1 emoji.
The count of the likes / dislikes will be shown in the sidebar of an issue or PR.
@hkdobrev
Copy link
Contributor

I'd personally want see these new sections in the sidebar named upvotes / downvotes instead of likes / dislikes. Or even better we could use the actual emoji instead of words.


125 馃憤


1 馃憥

@SpaceK33z
Copy link
Contributor Author

Good point, I will fix this.

@tngan
Copy link

tngan commented Feb 18, 2016

Do we have to consider about the compatibility of ES6 syntax across different browser version, even in mobile ?

@sindresorhus
Copy link
Member

Or even better we could use the actual emoji instead of words.

馃憤

Do we have to consider about the compatibility of ES6 syntax across different browser version, even in mobile ?

No, this is a Chrome extension, so we can use anything the latest Chrome version supports.

@sindresorhus
Copy link
Member

@SpaceK33z Can you fix the merge conflict?

voteHeading.className = 'discussion-sidebar-heading';
voteHeading.textContent = count + ' ' + type;
voteElement.appendChild(voteHeading);
sidebar.appendChild(voteElement);
Copy link
Member

Choose a reason for hiding this comment

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

This is very verbose. Can you just use a HTML string?

@tngan
Copy link

tngan commented Feb 18, 2016

Sometimes +1 and comments are given to a specific response rather than the topic itself. Is it okay to count those +1/upvote/downvote as a whole ?

@sindresorhus
Copy link
Member

@tngan Would be hard differentiate that, though. I think this is good for now and we can improve it over time.

- Use `includes` instead of `indexOf`
- Use jQuery instead of native DOM api
- `remove` instead of `removeChild`
@SpaceK33z
Copy link
Contributor Author

Yeah I see this as a simple first version which should certainly be improved. Later we could improve it with:

  • Smarter detection, like:
    • <upvote emoji> <other emoji>, e.g. 馃憤 馃挴
    • <upvote emoji> <useless word>, e.g. 馃憤 yes!
  • Count one vote per user. In a PR, a user can first down vote, but after some changes up vote. Only the up vote should count in this scenario.
  • If the upvote / downvote is followed by some text, don't remove the comment but let it count.

@sindresorhus, I've implemented your feedback.

If you type a comment with `:+1: `, this went undetected. Not entirely happy with how I fixed it, but it does make it easier to add detection for words after a thumbs up in the future.

Tested on a few pages:
- isaacs/github#253
- isaacs/github#9
@SpaceK33z
Copy link
Contributor Author

Okay, I'm done now :).

@sindresorhus
Copy link
Member

Super nice work on this @SpaceK33z :D

Would you mind opening an issue with your above ideas on further improvements?

@sindresorhus
Copy link
Member

Adding you to the repo since per the open open source idea.

@SpaceK33z
Copy link
Contributor Author

@sindresorhus thanks for that! Will open an issue later.

@SpaceK33z SpaceK33z deleted the like-dislike-count branch February 23, 2016 11:19
hkdobrev added a commit that referenced this pull request Apr 6, 2016
Closes #74.

Removes the work done in: #17, #39 and #73.
hkdobrev added a commit that referenced this pull request Apr 6, 2016
Closes #74.

Removes the work done in: #17, #39 and #73.
hkdobrev added a commit that referenced this pull request Apr 6, 2016
Closes #74.

Removes the work done in: #17, #39 and #73.
sindresorhus pushed a commit that referenced this pull request Apr 7, 2016
Closes #74.



Removes the work done in: #17, #39 and #73.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants