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

Allow more emojis. Disallow commentating in goodbyes. #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ouija.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ function updatePostFlair(post, response){
//awesome workaround from https://mathiasbynens.be/notes/javascript-unicode
//for getting accurate character count even when handling emojis
function countSymbols(string) {
// Do not count emoji variations and modifiers, http://unicode.org/reports/tr51/index.html
string = string.replace(/[\u{20E0}\u{20E3}\u{FE0E}\u{FE0F}\u{1F3FB}-\u{1F3FF}]/ug,'');
Copy link
Owner

Choose a reason for hiding this comment

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

What exactly would this prevent, and why would we want to prevent it?

Copy link
Owner

@mattdiamond mattdiamond Dec 28, 2016

Choose a reason for hiding this comment

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

Oh I see, this would potentially allow more emojis from being weeded out. Can you confirm that calling Array.from(string).length on these emoji variations returns > 1?

Copy link
Author

@potswa potswa Dec 28, 2016

Choose a reason for hiding this comment

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

  1. It restricts the text after "goodbye" to a period. Users occasionally put commentary there, which leads to more goodbye messages and biased/slower resolution.

  2. I tested both changes in my browser but I don't have node.js so you might verify them. I checked out ouijabot to debug why "⚡️" wasn't getting accepted and found that (in my browser) Array.from("⚡️").length > 1.

return Array.from(string).length;
}

Expand Down