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

fix: Invalid JSON in Custom Translations setting crashes the UI #28600

Merged
merged 8 commits into from
Apr 7, 2023

Conversation

matheusbsilva137
Copy link
Member

@matheusbsilva137 matheusbsilva137 commented Mar 24, 2023

Proposed changes (including videos or screenshots)

  • Check if JSON code settings (with type: code and code: application/json) are valid before saving, or throw an error otherwise;
  • Dismiss custom settings when the custom translations JSON provided is invalid (instead of throwing an error and crashing the UI);
  • Fix the Custom Translations setting desciption so that the example is shown as a code snippet.

Issue(s)

Fixes #27846

Steps to test or reproduce

  • Go to Workspace > Settings > General > Translations > Custom Translations and try adding an invalid JSON to the field. An error should be thrown displaying "Invalid JSON provided".
  • Add a valid JSON to the field and save the changes. Then, try erasing the JSON inserted in the field -- this action should be performed succesfully.

Further comments

TC-554

@matheusbsilva137 matheusbsilva137 requested a review from a team as a code owner March 24, 2023 16:00
@codecov
Copy link

codecov bot commented Mar 24, 2023

Codecov Report

Merging #28600 (eadb864) into develop (2eb690e) will decrease coverage by 0.02%.
The diff coverage is 20.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #28600      +/-   ##
===========================================
- Coverage    45.39%   45.37%   -0.02%     
===========================================
  Files          728      728              
  Lines        14202    14206       +4     
  Branches      2189     2189              
===========================================
- Hits          6447     6446       -1     
- Misses        7448     7455       +7     
+ Partials       307      305       -2     
Flag Coverage Δ
e2e 45.33% <20.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

yash-rajpal
yash-rajpal previously approved these changes Mar 30, 2023
yash-rajpal
yash-rajpal previously approved these changes Mar 30, 2023
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Apr 6, 2023
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Apr 6, 2023
@kodiakhq kodiakhq bot merged commit bc22cfa into develop Apr 7, 2023
@kodiakhq kodiakhq bot deleted the fix/custom-translation-json branch April 7, 2023 01:23
gabriellsh added a commit that referenced this pull request Apr 12, 2023
…hideSysMes

* 'develop' of github.com:RocketChat/Rocket.Chat: (50 commits)
  fix: application crashing when clicking on "Files" button (#28878)
  revert: rate limiter bindEnvironment
  refactor: Changed settings registry's callbacks to work with async functions (#28784)
  revert: removal of `Meteor.bindEnvironment` on `DDPRateLimiter.addRule` (#28874)
  chore: Limit 10 usernames on reactions tooltip (#28141)
  fix: quote line break (#28798)
  fix: Add function to get installation source (#28806)
  regression: `fetch` call in `getWorkspaceAccessTokenWithScope` (#28866)
  fix(docs,readme): use raw image url (#28861)
  refactor: Make onLicense support async callbacks (#28791)
  refactor: remove some Meteor.bindEnvironment (#28822)
  refactor: Move callbacks to ts - 2 (#28771)
  chore: Update issue_template.md (#28753)
  fix: Fixed business hours route redirect (#28344)
  feat: add GA4 support (#28830)
  chore(deps): Prettier version (#28857)
  remove meteor.call from server (#28774)
  refactor: Remove fibers from `linkedin-oauth` (#28779)
  fix: Invalid JSON in Custom Translations setting crashes the UI (#28600)
  regression(e2e): Missing private key blocks sending message in encrypted rooms (#28831)
  ...
@sampaiodiego sampaiodiego mentioned this pull request May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA tested stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Translation allows invalid json and break UI
4 participants