浏览代码

fix(display-name): dismiss prompt if name gets set

master
Leonard Kim 5 年前
父节点
当前提交
2f7f9f24c4

+ 1
- 0
react/features/base/settings/index.js 查看文件

1
 export * from './actions';
1
 export * from './actions';
2
+export * from './actionTypes';
2
 export * from './constants';
3
 export * from './constants';
3
 export * from './functions';
4
 export * from './functions';
4
 
5
 

+ 1
- 1
react/features/chat/components/native/ChatButton.js 查看文件

96
         },
96
         },
97
 
97
 
98
         /**
98
         /**
99
-         * Displays a diaply name prompt.
99
+         * Displays a display name prompt.
100
          *
100
          *
101
          * @param {Function} onPostSubmit - The function to invoke after a
101
          * @param {Function} onPostSubmit - The function to invoke after a
102
          * succesfulsetting of the display name.
102
          * succesfulsetting of the display name.

+ 2
- 0
react/features/display-name/index.js 查看文件

3
 export * from './actions';
3
 export * from './actions';
4
 export * from './components';
4
 export * from './components';
5
 export * from './functions';
5
 export * from './functions';
6
+
7
+import './middleware';

+ 25
- 0
react/features/display-name/middleware.js 查看文件

1
+// @flow
2
+
3
+import { hideDialog, isDialogOpen } from '../base/dialog';
4
+import { MiddlewareRegistry } from '../base/redux';
5
+import { SETTINGS_UPDATED } from '../base/settings';
6
+import { DisplayNamePrompt } from './components';
7
+
8
+/**
9
+ * Middleware that captures actions related to display name setting.
10
+ *
11
+ * @param {Store} store - The redux store.
12
+ * @returns {Function}
13
+ */
14
+MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
15
+    switch (action.type) {
16
+    case SETTINGS_UPDATED: {
17
+        if (action.settings.displayName
18
+            && isDialogOpen(getState, DisplayNamePrompt)) {
19
+            dispatch(hideDialog(DisplayNamePrompt));
20
+        }
21
+    }
22
+    }
23
+
24
+    return next(action);
25
+});

正在加载...
取消
保存