Skip to content

Implement like / dislike count - #17

Closed
SpaceK33z wants to merge 6 commits into
refined-github:masterfrom
SpaceK33z:like-dislike-count
Closed

SpaceK33z wants to merge 6 commits into
refined-github:masterfrom
SpaceK33z:like-dislike-count

Conversation

@SpaceK33z

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Good point, I will fix this.

@tngan

tngan commented Feb 18, 2016

Copy link
Copy Markdown

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

@sindresorhus

Copy link
Copy Markdown
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
Copy Markdown
Member

@SpaceK33z Can you fix the merge conflict?

Comment thread extension/content.js Outdated
voteHeading.className = 'discussion-sidebar-heading';
voteHeading.textContent = count + ' ' + type;
voteElement.appendChild(voteHeading);
sidebar.appendChild(voteElement);

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.

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

@tngan

tngan commented Feb 18, 2016

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Okay, I'm done now :).

@sindresorhus

Copy link
Copy Markdown
Member

Super nice work on this @SpaceK33z :D

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

@sindresorhus

Copy link
Copy Markdown
Member

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

@SpaceK33z

Copy link
Copy Markdown
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.

4 participants