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

chore(emoji): Fix issue where numbers and some symbols got big_emoji class applied #1469

Merged
merged 8 commits into from
Nov 8, 2023

Conversation

WanderingHogan
Copy link
Contributor

What this PR does 📖

This is a workaround for the big numbers in chat, if you send them by themselves.

We rely on this crate: https://crates.io/crates/unic-emoji-char/0.8.0

That crate has this bug: open-i18n/rust-unic#280

numbers and some symbols (like # and *) trigger the emoji checks from that crate.

Which issue(s) this PR fixes 🔨

Special notes for reviewers 🗒️

Additional comments 🎤

Copy link

coderabbitai bot commented Nov 7, 2023

Walkthrough
# Walkthrough

The changes primarily focus on the `markdown` function in `kit/src/components/message/mod.rs`. A temporary workaround has been introduced to handle certain characters that were mistakenly identified as emojis. The function now checks for specific characters and alphanumeric sequences before applying the emoji formatting. The logic for handling emojis has also been adjusted.

# Changes

| File | Change Summary |
| --- | --- |
| `kit/src/components/message/mod.rs` | Introduced a temporary workaround for certain characters mistakenly identified as emojis. The `markdown` function now checks for specific characters and alphanumeric sequences before applying the emoji formatting. The logic for handling emojis has been adjusted. |

# Assessment against linked issues (Beta)

| Objective | Addressed | Explanation |
| --- | --- | --- |
| Identify and fix the bug causing the font size to increase when numbers are sent in the chat (#1468) || |
| Ensure that the font size remains consistent regardless of the content of the message (text, numbers, symbols, etc.) (#1468) || |
| Understand the goal of the GitHub issue, which is to create a proof of concept for integrating Tailwind CSS with Rust (#001) || The changes in this PR do not pertain to the integration of Tailwind CSS with Rust. |
| Analyze the process of running `make tailwind`, which should identify any classes defined in Rust files and include them in the generated stylesheet (#001) || The changes in this PR do not pertain to the `make tailwind` process. |
| Identify the technical requirements and constraints for this integration, including any necessary dependencies or configurations (#001) || The changes in this PR do not pertain to the technical requirements and constraints for integrating Tailwind CSS with Rust. |

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

@github-actions github-actions bot added Don't merge yet DO NOT MERGE Missing dev review Still needs to be reviewed by a dev labels Nov 7, 2023
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 2a53adc and b164cb5.
Files selected for processing (1)
  • kit/src/components/message/mod.rs (1 hunks)
Additional comments: 2
kit/src/components/message/mod.rs (2)
  • 452-452: The comment provides a link to the issue in the rust-unic repository. This is good practice as it provides context for the workaround and allows developers to track the progress of the issue.

  • 458-461: The code returns a formatted string with the appropriate span class based on the checks. This is a good use of the format! macro to create a string with embedded values.

kit/src/components/message/mod.rs Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 3

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between b164cb5 and e56882d.
Files selected for processing (1)
  • kit/src/components/message/mod.rs (1 hunks)

kit/src/components/message/mod.rs Outdated Show resolved Hide resolved
kit/src/components/message/mod.rs Outdated Show resolved Hide resolved
kit/src/components/message/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Nov 7, 2023

UI Automated Test Results Summary for MacOS/Windows

476 tests   266 ✔️  2h 10m 41s ⏱️
  41 suites  210 💤
    3 files        0

Results for commit 10cc410.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Nov 7, 2023

UI Automated Tests execution is complete! You can find the test results report here

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between e56882d and 00f4649.
Files selected for processing (1)
  • kit/src/components/message/mod.rs (1 hunks)

kit/src/components/message/mod.rs Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 00f4649 and 540b420.
Files selected for processing (1)
  • kit/src/components/message/mod.rs (1 hunks)
Additional comments: 2
kit/src/components/message/mod.rs (2)
  • 450-461: The code is returning HTML directly from the function. This could potentially lead to XSS (Cross-Site Scripting) vulnerabilities if r contains any user-supplied input. Consider using a safe method to escape any potential HTML in r before returning it.
return format!("<span class=\"big-emoji\">{}</span>", html_escape::encode_text(&r));
  • 453-456: The workaround checks for specific characters and alphanumeric sequences. Ensure that this workaround does not interfere with the normal functioning of the chat feature and that it correctly identifies all emojis.

kit/src/components/message/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@sdwoodbury sdwoodbury left a comment

Choose a reason for hiding this comment

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

coderabbit is very wrong regarding this PR. lol

@sdwoodbury sdwoodbury added Ready for testing Ready for QA to test and removed Missing dev review Still needs to be reviewed by a dev labels Nov 7, 2023
@tooshel
Copy link
Contributor

tooshel commented Nov 7, 2023

coderabbit is very wrong regarding this PR. lol

This part?
image

@stavares843 stavares843 added Changes requested When other dev or QA request a change and removed Ready for testing Ready for QA to test labels Nov 7, 2023
@phillsatellite
Copy link
Contributor

@WanderingHogan On all OS's this seems to break markdowns ☹️
Screenshot 2023-11-07 at 2 23 15 PM

@WanderingHogan WanderingHogan removed the Changes requested When other dev or QA request a change label Nov 8, 2023
@WanderingHogan
Copy link
Contributor Author

@phillsatellite i think it is ready to try again, sorry about that

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 3

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 540b420 and 285b437.
Files selected for processing (1)
  • kit/src/components/message/mod.rs (1 hunks)

kit/src/components/message/mod.rs Show resolved Hide resolved
kit/src/components/message/mod.rs Show resolved Hide resolved
kit/src/components/message/mod.rs Show resolved Hide resolved
@phillsatellite phillsatellite added QA Tested QA has tested and approved Ready to Merge This PR is ready to merge and removed Don't merge yet DO NOT MERGE labels Nov 8, 2023
@phillsatellite phillsatellite merged commit 3dd8dff into dev Nov 8, 2023
10 checks passed
@phillsatellite phillsatellite deleted the big_numbers branch November 8, 2023 22:28
@github-actions github-actions bot removed QA Tested QA has tested and approved Ready to Merge This PR is ready to merge labels Nov 8, 2023
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.

bug(chat): sending numbers the font is not displayed properly
6 participants