mirror of
				https://github.com/vector-im/element-web.git
				synced 2025-10-31 00:01:23 +01:00 
			
		
		
		
	Merge remote-tracking branch 'origin/develop' into dbkr/add_threepid_ui_auth
This commit is contained in:
		
						commit
						4a56aa16b8
					
				| @ -22,6 +22,10 @@ import Modal from './Modal'; | |||||||
| import { _t } from './languageHandler'; | import { _t } from './languageHandler'; | ||||||
| import IdentityAuthClient from './IdentityAuthClient'; | import IdentityAuthClient from './IdentityAuthClient'; | ||||||
| 
 | 
 | ||||||
|  | function getIdServerDomain() { | ||||||
|  |     return MatrixClientPeg.get().idBaseUrl.split("://")[1]; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * Allows a user to add a third party identifier to their homeserver and, |  * Allows a user to add a third party identifier to their homeserver and, | ||||||
|  * optionally, the identity servers. |  * optionally, the identity servers. | ||||||
| @ -166,7 +170,7 @@ export default class AddThreepid { | |||||||
|                     await MatrixClientPeg.get().bindThreePid({ |                     await MatrixClientPeg.get().bindThreePid({ | ||||||
|                         sid: this.sessionId, |                         sid: this.sessionId, | ||||||
|                         client_secret: this.clientSecret, |                         client_secret: this.clientSecret, | ||||||
|                         id_server: identityServerDomain, |                         id_server: getIdServerDomain(), | ||||||
|                         id_access_token: identityAccessToken, |                         id_access_token: identityAccessToken, | ||||||
|                     }); |                     }); | ||||||
|                 } else { |                 } else { | ||||||
| @ -198,7 +202,7 @@ export default class AddThreepid { | |||||||
|                 await MatrixClientPeg.get().addThreePid({ |                 await MatrixClientPeg.get().addThreePid({ | ||||||
|                     sid: this.sessionId, |                     sid: this.sessionId, | ||||||
|                     client_secret: this.clientSecret, |                     client_secret: this.clientSecret, | ||||||
|                     id_server: identityServerDomain, |                     id_server: getIdServerDomain(), | ||||||
|                 }, this.bind); |                 }, this.bind); | ||||||
|             } |             } | ||||||
|         } catch (err) { |         } catch (err) { | ||||||
| @ -260,7 +264,7 @@ export default class AddThreepid { | |||||||
|                 await MatrixClientPeg.get().bindThreePid({ |                 await MatrixClientPeg.get().bindThreePid({ | ||||||
|                     sid: this.sessionId, |                     sid: this.sessionId, | ||||||
|                     client_secret: this.clientSecret, |                     client_secret: this.clientSecret, | ||||||
|                     id_server: identityServerDomain, |                     id_server: getIdServerDomain(), | ||||||
|                     id_access_token: await authClient.getAccessToken(), |                     id_access_token: await authClient.getAccessToken(), | ||||||
|                 }); |                 }); | ||||||
|             } else { |             } else { | ||||||
| @ -292,7 +296,7 @@ export default class AddThreepid { | |||||||
|             await MatrixClientPeg.get().addThreePid({ |             await MatrixClientPeg.get().addThreePid({ | ||||||
|                 sid: this.sessionId, |                 sid: this.sessionId, | ||||||
|                 client_secret: this.clientSecret, |                 client_secret: this.clientSecret, | ||||||
|                 id_server: identityServerDomain, |                 id_server: getIdServerDomain(), | ||||||
|             }, this.bind); |             }, this.bind); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -73,6 +73,14 @@ export default createReactClass({ | |||||||
|         this._detailsRef.removeEventListener("toggle", this.onDetailsToggled); |         this._detailsRef.removeEventListener("toggle", this.onDetailsToggled); | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|  |     _onKeyDown: function(event) { | ||||||
|  |         if (event.key === "Enter") { | ||||||
|  |             this.onOk(); | ||||||
|  |             event.preventDefault(); | ||||||
|  |             event.stopPropagation(); | ||||||
|  |         } | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|     onOk: async function() { |     onOk: async function() { | ||||||
|         const activeElement = document.activeElement; |         const activeElement = document.activeElement; | ||||||
|         if (activeElement) { |         if (activeElement) { | ||||||
| @ -176,7 +184,7 @@ export default createReactClass({ | |||||||
|             <BaseDialog className="mx_CreateRoomDialog" onFinished={this.props.onFinished} |             <BaseDialog className="mx_CreateRoomDialog" onFinished={this.props.onFinished} | ||||||
|                 title={title} |                 title={title} | ||||||
|             > |             > | ||||||
|                 <form onSubmit={this.onOk}> |                 <form onSubmit={this.onOk} onKeyDown={this._onKeyDown}> | ||||||
|                     <div className="mx_Dialog_content"> |                     <div className="mx_Dialog_content"> | ||||||
|                         <Field id="name" ref={ref => this._nameFieldRef = ref} label={ _t('Name') } onChange={this.onNameChange} onValidate={this.onNameValidate} value={this.state.name} className="mx_CreateRoomDialog_name" /> |                         <Field id="name" ref={ref => this._nameFieldRef = ref} label={ _t('Name') } onChange={this.onNameChange} onValidate={this.onNameValidate} value={this.state.name} className="mx_CreateRoomDialog_name" /> | ||||||
|                         <Field id="topic" label={ _t('Topic (optional)') } onChange={this.onTopicChange} value={this.state.topic} /> |                         <Field id="topic" label={ _t('Topic (optional)') } onChange={this.onTopicChange} value={this.state.topic} /> | ||||||
|  | |||||||
| @ -90,6 +90,7 @@ export default class BasicMessageEditor extends React.Component { | |||||||
|         this._modifiedFlag = false; |         this._modifiedFlag = false; | ||||||
|         this._isIMEComposing = false; |         this._isIMEComposing = false; | ||||||
|         this._hasTextSelected = false; |         this._hasTextSelected = false; | ||||||
|  |         this._emoticonSettingHandle = null; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     _replaceEmoticon = (caretPosition, inputType, diff) => { |     _replaceEmoticon = (caretPosition, inputType, diff) => { | ||||||
| @ -437,18 +438,25 @@ export default class BasicMessageEditor extends React.Component { | |||||||
|         this.setState({completionIndex}); |         this.setState({completionIndex}); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     _configureEmoticonAutoReplace() { | ||||||
|  |         const shouldReplace = SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji'); | ||||||
|  |         this.props.model.setTransformCallback(shouldReplace ? this._replaceEmoticon : null); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     componentWillUnmount() { |     componentWillUnmount() { | ||||||
|         this._editorRef.removeEventListener("input", this._onInput, true); |         this._editorRef.removeEventListener("input", this._onInput, true); | ||||||
|         this._editorRef.removeEventListener("compositionstart", this._onCompositionStart, true); |         this._editorRef.removeEventListener("compositionstart", this._onCompositionStart, true); | ||||||
|         this._editorRef.removeEventListener("compositionend", this._onCompositionEnd, true); |         this._editorRef.removeEventListener("compositionend", this._onCompositionEnd, true); | ||||||
|  |         SettingsStore.unwatchSetting(this._emoticonSettingHandle); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     componentDidMount() { |     componentDidMount() { | ||||||
|         const model = this.props.model; |         const model = this.props.model; | ||||||
|         model.setUpdateCallback(this._updateEditorState); |         model.setUpdateCallback(this._updateEditorState); | ||||||
|         if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) { |         this._emoticonSettingHandle = SettingsStore.watchSetting('MessageComposerInput.autoReplaceEmoji', null, () => { | ||||||
|             model.setTransformCallback(this._replaceEmoticon); |             this._configureEmoticonAutoReplace(); | ||||||
|         } |         }); | ||||||
|  |         this._configureEmoticonAutoReplace(); | ||||||
|         const partCreator = model.partCreator; |         const partCreator = model.partCreator; | ||||||
|         // TODO: does this allow us to get rid of EditorStateTransfer?
 |         // TODO: does this allow us to get rid of EditorStateTransfer?
 | ||||||
|         // not really, but we could not serialize the parts, and just change the autoCompleter
 |         // not really, but we could not serialize the parts, and just change the autoCompleter
 | ||||||
|  | |||||||
| @ -193,8 +193,14 @@ export default class EmailAddresses extends React.Component { | |||||||
|             this.props.onEmailsChange(emails); |             this.props.onEmailsChange(emails); | ||||||
|         }).catch((err) => { |         }).catch((err) => { | ||||||
|             this.setState({continueDisabled: false}); |             this.setState({continueDisabled: false}); | ||||||
|             if (err.errcode !== 'M_THREEPID_AUTH_FAILED') { |             const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); | ||||||
|                 const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); |             if (err.errcode === 'M_THREEPID_AUTH_FAILED') { | ||||||
|  |                 Modal.createTrackedDialog("Email hasn't been verified yet", "", ErrorDialog, { | ||||||
|  |                     title: _t("Your email address hasn't been verified yet"), | ||||||
|  |                     description: _t("Click the link in the email you received to verify " + | ||||||
|  |                         "and then click continue again."), | ||||||
|  |                 }); | ||||||
|  |             } else { | ||||||
|                 console.error("Unable to verify email address: ", err); |                 console.error("Unable to verify email address: ", err); | ||||||
|                 Modal.createTrackedDialog('Unable to verify email address', '', ErrorDialog, { |                 Modal.createTrackedDialog('Unable to verify email address', '', ErrorDialog, { | ||||||
|                     title: _t("Unable to verify email address."), |                     title: _t("Unable to verify email address."), | ||||||
|  | |||||||
| @ -171,8 +171,14 @@ export class EmailAddress extends React.Component { | |||||||
|             }); |             }); | ||||||
|         } catch (err) { |         } catch (err) { | ||||||
|             this.setState({ continueDisabled: false }); |             this.setState({ continueDisabled: false }); | ||||||
|             if (err.errcode !== 'M_THREEPID_AUTH_FAILED') { |             const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); | ||||||
|                 const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); |             if (err.errcode === 'M_THREEPID_AUTH_FAILED') { | ||||||
|  |                 Modal.createTrackedDialog("E-mail hasn't been verified yet", "", ErrorDialog, { | ||||||
|  |                     title: _t("Your email address hasn't been verified yet"), | ||||||
|  |                     description: _t("Click the link in the email you received to verify " + | ||||||
|  |                         "and then click continue again."), | ||||||
|  |                 }); | ||||||
|  |             } else { | ||||||
|                 console.error("Unable to verify email address: " + err); |                 console.error("Unable to verify email address: " + err); | ||||||
|                 Modal.createTrackedDialog('Unable to verify email address', '', ErrorDialog, { |                 Modal.createTrackedDialog('Unable to verify email address', '', ErrorDialog, { | ||||||
|                     title: _t("Unable to verify email address."), |                     title: _t("Unable to verify email address."), | ||||||
|  | |||||||
| @ -742,6 +742,8 @@ | |||||||
|     "Who can read history?": "Who can read history?", |     "Who can read history?": "Who can read history?", | ||||||
|     "Unable to revoke sharing for email address": "Unable to revoke sharing for email address", |     "Unable to revoke sharing for email address": "Unable to revoke sharing for email address", | ||||||
|     "Unable to share email address": "Unable to share email address", |     "Unable to share email address": "Unable to share email address", | ||||||
|  |     "Your email address hasn't been verified yet": "Your email address hasn't been verified yet", | ||||||
|  |     "Click the link in the email you received to verify and then click continue again.": "Click the link in the email you received to verify and then click continue again.", | ||||||
|     "Unable to verify email address.": "Unable to verify email address.", |     "Unable to verify email address.": "Unable to verify email address.", | ||||||
|     "Verify the link in your inbox": "Verify the link in your inbox", |     "Verify the link in your inbox": "Verify the link in your inbox", | ||||||
|     "Complete": "Complete", |     "Complete": "Complete", | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| /* | /* | ||||||
| Copyright 2017 OpenMarket Ltd | Copyright 2017 OpenMarket Ltd | ||||||
| Copyright 2018 New Vector Ltd | Copyright 2018 New Vector Ltd | ||||||
|  | Copyright 2019 The Matrix.org Foundation C.I.C. | ||||||
| 
 | 
 | ||||||
| Licensed under the Apache License, Version 2.0 (the "License"); | Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
| you may not use this file except in compliance with the License. | you may not use this file except in compliance with the License. | ||||||
| @ -76,8 +77,22 @@ class ConsoleLogger { | |||||||
|         args = args.map((arg) => { |         args = args.map((arg) => { | ||||||
|             if (arg instanceof Error) { |             if (arg instanceof Error) { | ||||||
|                 return arg.message + (arg.stack ? `\n${arg.stack}` : ''); |                 return arg.message + (arg.stack ? `\n${arg.stack}` : ''); | ||||||
|             } else if (typeof(arg) === 'object') { |             } else if (typeof (arg) === 'object') { | ||||||
|                 return JSON.stringify(arg); |                 try { | ||||||
|  |                     return JSON.stringify(arg); | ||||||
|  |                 } catch (e) { | ||||||
|  |                     // In development, it can be useful to log complex cyclic
 | ||||||
|  |                     // objects to the console for inspection. This is fine for
 | ||||||
|  |                     // the console, but default `stringify` can't handle that.
 | ||||||
|  |                     // We workaround this by using a special replacer function
 | ||||||
|  |                     // to only log values of the root object and avoid cycles.
 | ||||||
|  |                     return JSON.stringify(arg, (key, value) => { | ||||||
|  |                         if (key && typeof value === "object") { | ||||||
|  |                             return "<object>"; | ||||||
|  |                         } | ||||||
|  |                         return value; | ||||||
|  |                     }); | ||||||
|  |                 } | ||||||
|             } else { |             } else { | ||||||
|                 return arg; |                 return arg; | ||||||
|             } |             } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user