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

Custom Translation allows invalid json and break UI #27846

Closed
sector7gp opened this issue Jan 25, 2023 · 11 comments · Fixed by #28600
Closed

Custom Translation allows invalid json and break UI #27846

sector7gp opened this issue Jan 25, 2023 · 11 comments · Fixed by #28600
Labels
contrib: good first issue Issues that you can solve to start contributing :)

Comments

@sector7gp
Copy link

sector7gp commented Jan 25, 2023

Description:

We wanted to make some changes using custom translation, we forgot to include the <br/> tag at the beginning, so the front end had broken

Steps to reproduce:

  1. Settings
  2. General
  3. Translations
  4. Custom translations
  5. Set the field with: <code>{ "en": { "Channels": "Rooms" }, "pt": { "Channels": "Salas" } }</code> ignoring the<br/>
    the next output is how is setted in the setting document in mongo:
 db.rocketchat_settings.find({_id : "Custom_Translations"}).pretty()
{
        "_id" : "Custom_Translations",
        "createdAt" : ISODate("2022-12-05T20:37:53.542Z"),
        "value" : "<code>{ \"en\": { \"Welcome\": \"Bienvenidos\" } }</code>",
        "packageValue" : "",
        "valueSource" : "packageValue",
        "secret" : false,
        "enterprise" : false,
        "i18nDescription" : "Custom_Translations_Description",
        "autocomplete" : true,
        "sorter" : 25000,
        "ts" : ISODate("2022-12-05T20:37:53.542Z"),
        "type" : "code",
        "group" : "General",
        "section" : "Translations",
        "public" : true,
        "i18nLabel" : "Custom_Translations",
        "hidden" : false,
        "blocked" : false,
        "requiredOnWizard" : false,
        "env" : false,
        "_updatedAt" : ISODate("2023-01-25T13:26:36.722Z")
}

notice the lack of the <br/> tag in the value field

Expected behavior:

The front end still alive

Actual behavior:

The front end breaks

image

Server Setup Information:

Implementación
Versión 5.4.1
ID de implementación BY5JmCq5iXeezaP5e
Versión de motor de aplicaciones 1.36.0
Versión de nodo v14.19.3
Migración de base de datos
281 (25 de enero de 2023 10:28)
MongoDB 5.0.8 / wiredTiger (oplog Habilitada)
Detalles de confirmación HEAD: (f7908e8)
Rama: HEAD
PID 751170

Client Setup Information

Happens only in web and desktop app

Workarround

Change the setting by mongosh

Open your OS terminal

open monsgo console

> mongo

Run this query to show the values in the DB

rs01:PRIMARY> db.rocketchat_settings.find({_id : \"Custom_Translations\"}).pretty()

run this query to clean the custom field

rs01:PRIMARY> db.rocketchat_settings.update({"_id":"Custom_Translations"},{$set:{"value":""}})

Relevant logs:

@dudanogueira
Copy link
Contributor

Hi! That field should be filled only with a json.

no <code> or </code> or <br />

I think the bug here is the help text for that field and also the fact that it doesn't validate the Json before saving.

@dudanogueira dudanogueira changed the title Custom Translation fail, makes frontend break Custom Translation allows invalid json and break UI Jan 26, 2023
@dudanogueira dudanogueira added the contrib: good first issue Issues that you can solve to start contributing :) label Jan 26, 2023
@Pradumn27
Copy link

Hi @dudanogueira can you assign me this issue?

@ghost
Copy link

ghost commented Jan 27, 2023

Hi, I can fix this issue kindly assign me

@dudanogueira
Copy link
Contributor

Nice PR, @Pradumn27 !! Congratulations!!!

@Gauravjadhav22
Copy link

hey,
i can fix this issue please assign me!..

@Akshaybagai52
Copy link

Hey I can fix this issue
Can you assign me?

@Gua00va
Copy link

Gua00va commented Feb 15, 2023

Hey!! I want to work on this issue. I'm new here so I'm really excited to start contributing. Please assign it to me.

@MewadaAnkit
Copy link

Hey , I want to work on this issue . Please assign it to me.

@Shiva953
Copy link

Hey,is this issue still open? I would like to work on it.

@tejastomarbyte
Copy link

Hey, is this isssue still open? Please assign it to me I would like to work on it.

@enoch85
Copy link

enoch85 commented Mar 9, 2023

This happened to me today as well. Would be super nice if the PR could be merged soon!

cc @dougfabris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contrib: good first issue Issues that you can solve to start contributing :)
Projects
None yet
10 participants