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

Foorm: allow emojis in submissions #34868

Merged
merged 2 commits into from
May 19, 2020
Merged

Conversation

breville
Copy link
Member

@breville breville commented May 19, 2020

By changing the Foorm::Submission backing table to use utf8mb4 instead of utf8 encoding, we now support emojis in Foorm submissions.

Successful submission as seen in dashboard-console:

Screenshot 2020-05-19 09 40 53

Successful submission seen in facilitator results:

Screenshot 2020-05-19 09 40 12

By changing the Foorm::Submission backing table to use utf8mb4 instead of utf8 encoding, we now support emojis in Foorm submissions.
Comment on lines 15 to 23
before_validation :strip_emoji_from_answers

# Drops unicode characters not supported by utf8mb3 strings (most commonly emoji)
# from the submission answers
# We can remove this once our database has utf8mb4 support everywhere.
def strip_emoji_from_answers
# Drop emoji and other unsupported characters
self.answers = answers&.strip_utf8mb4&.strip
end
Copy link
Member Author

Choose a reason for hiding this comment

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

I can move this change to a followup PR before merging.

@breville breville requested review from molly-moen, wjordan and a team May 19, 2020 16:53
Continue filtering emojis until our change to the table encoding is live.
@breville breville requested a review from wjordan May 19, 2020 18:56
@breville breville merged commit 8e1afcf into staging May 19, 2020
@breville breville deleted the allow-emojis-in-foorm-submissions branch May 19, 2020 18:56
@breville
Copy link
Member Author

It's interesting that when building this PR on my local machine, the character-encoding migration generated a text limit of 4294967295 (4 GB), but when we ran the same migration on staging, it generated a schema.rb change with 16777215 (16 MB) instead. The former is the length of a longtext, while the latter is a mediumtext. Oddly, my local mysql reported the column type as mediumtext.

At any rate, that staging change was scooped here.

breville added a commit that referenced this pull request May 20, 2020
Followup to the migration in #34868.  Now that the migration is live, we can discontinue filtering emojis out of Foorm submissions.

Also updates an annotation.
wjordan added a commit that referenced this pull request Nov 25, 2020
Followup to #34868 which modified DB connection settings
causing databases to be created with utf8mb4 by default.
This migration should bring settings in existing databases
back in sync with the new default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants