xrav3nz
13 Septiembre, 2019 14:18
8
Respondiendo aquí para que otros tengan el contexto.
Pensé que esto era extraño porque la pestaña de notificaciones no comparte la misma ruta de renderizado que las demás, así que revertí localmente la nueva función de acceso rápido y aún puedo reproducir el problema:
Creo que se trata de un caso muy excepcional con nuestra función I18n.t del lado del cliente, y aquí hay una prueba mínima que falla para ello: https://github.com/xrav3nz/discourse/commit/3d7324281a285158fe75f9e7b42574906c940e49 .
Solucionado con:
master ← xrav3nz:fix/i18n-js-edge-case
merged 05:52PM - 16 Sep 19 UTC
> Context: https://meta.discourse.org/t/notification-character-bug/128461/8
I… was almost pulling my hairs out wondering why this would happen, then I took a closer look at [the `replace(pattern, replacement)` function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter):
> The `replacement` string can include the following special replacement patterns:
>
> Pattern | Inserts
> -- | --
> $& | Inserts the matched substring.
> ... | ...
The dollar sign (`$`) is a special replace pattern, and `$&` inserts the matched string... 😅 Thus dollars signs need to be escaped with the special pattern `$$`, which inserts a single `$`.
Let me know what you think, thanks!
9 Me gusta