浏览代码

fix: remove unnecessary escaping

master
Bettenbuk Zoltan 6 年前
父节点
当前提交
f270b50972
共有 2 个文件被更改,包括 3 次插入13 次删除
  1. 1
    7
      react/features/chat/components/web/ChatMessage.js
  2. 2
    6
      react/features/chat/middleware.js

+ 1
- 7
react/features/chat/components/web/ChatMessage.js 查看文件

30
             })
30
             })
31
             : message.message;
31
             : message.message;
32
 
32
 
33
-        // replace links and smileys
34
-        // Strophe already escapes special symbols on sending,
35
-        // so we escape here only tags to avoid double &
36
-        const escMessage = messageToDisplay.replace(/</g, '&lt;')
37
-            .replace(/>/g, '&gt;')
38
-            .replace(/\n/g, '<br/>');
39
         const processedMessage = [];
33
         const processedMessage = [];
40
 
34
 
41
         // content is an array of text and emoji components
35
         // content is an array of text and emoji components
42
-        const content = toArray(escMessage, { className: 'smiley' });
36
+        const content = toArray(messageToDisplay, { className: 'smiley' });
43
 
37
 
44
         content.forEach(i => {
38
         content.forEach(i => {
45
             if (typeof i === 'string') {
39
             if (typeof i === 'string') {

+ 2
- 6
react/features/chat/middleware.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
-import UIUtil from '../../../modules/UI/util/UIUtil';
4
-
5
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
3
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
6
 import {
4
 import {
7
     CONFERENCE_JOINED,
5
     CONFERENCE_JOINED,
49
         const { conference } = store.getState()['features/base/conference'];
47
         const { conference } = store.getState()['features/base/conference'];
50
 
48
 
51
         if (conference) {
49
         if (conference) {
52
-            const escapedMessage = UIUtil.escapeHtml(action.message);
53
-
54
             if (typeof APP !== 'undefined') {
50
             if (typeof APP !== 'undefined') {
55
-                APP.API.notifySendingChatMessage(escapedMessage);
51
+                APP.API.notifySendingChatMessage(action.message);
56
             }
52
             }
57
-            conference.sendTextMessage(escapedMessage);
53
+            conference.sendTextMessage(action.message);
58
         }
54
         }
59
         break;
55
         break;
60
     }
56
     }

正在加载...
取消
保存