ソースを参照

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

master
Leonard Kim 5年前
コミット
2f7f9f24c4

+ 1
- 0
react/features/base/settings/index.js ファイルの表示

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

+ 1
- 1
react/features/chat/components/native/ChatButton.js ファイルの表示

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

+ 2
- 0
react/features/display-name/index.js ファイルの表示

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

+ 25
- 0
react/features/display-name/middleware.js ファイルの表示

@@ -0,0 +1,25 @@
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
+});

読み込み中…
キャンセル
保存