Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

Leonard Kim2f7f9f24c4f9
diff --git a/react/features/base/settings/index.js b/react/features/base/settings/index.js
index 086f53a9e1..39f1ee456a 100644
--- a/react/features/base/settings/index.js
+++ b/react/features/base/settings/index.js
@@ -1,4 +1,5 @@
export * from './actions';
+export * from './actionTypes';
export * from './constants';
export * from './functions';
diff --git a/react/features/chat/components/native/ChatButton.js b/react/features/chat/components/native/ChatButton.js
index 52fc70c803..2461d31277 100644
--- a/react/features/chat/components/native/ChatButton.js
+++ b/react/features/chat/components/native/ChatButton.js
@@ -96,7 +96,7 @@ function _mapDispatchToProps(dispatch: Function) {
},
/**
- * Displays a diaply name prompt.
+ * Displays a display name prompt.
*
* @param {Function} onPostSubmit - The function to invoke after a
* succesfulsetting of the display name.
diff --git a/react/features/display-name/index.js b/react/features/display-name/index.js
index c13d3e017d..46a00713e0 100644
--- a/react/features/display-name/index.js
+++ b/react/features/display-name/index.js
@@ -3,3 +3,5 @@
export * from './actions';
export * from './components';
export * from './functions';
+
+import './middleware';
diff --git a/react/features/display-name/middleware.js b/react/features/display-name/middleware.js
new file mode 100644
index 0000000000..652a7f33df
--- /dev/null
+++ b/react/features/display-name/middleware.js
@@ -0,0 +1,25 @@
+// @flow
+
+import { hideDialog, isDialogOpen } from '../base/dialog';
+import { MiddlewareRegistry } from '../base/redux';
+import { SETTINGS_UPDATED } from '../base/settings';
+import { DisplayNamePrompt } from './components';
+
+/**
+ * Middleware that captures actions related to display name setting.
+ *
+ * @param {Store} store - The redux store.
+ * @returns {Function}
+ */
+MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
+ switch (action.type) {
+ case SETTINGS_UPDATED: {
+ if (action.settings.displayName
+ && isDialogOpen(getState, DisplayNamePrompt)) {
+ dispatch(hideDialog(DisplayNamePrompt));
+ }
+ }
+ }
+
+ return next(action);
+});