Consolidate random string generation to make Sonar happier (#8675)
* Consolidate random string generation to make Sonar happier * Update snapshots
This commit is contained in:
parent
9f1bffcd34
commit
fe21ec8715
4 changed files with 13 additions and 11 deletions
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
|
||||
import React from 'react';
|
||||
import { MatrixEvent } from 'matrix-js-sdk/src/models/event';
|
||||
import { randomString } from 'matrix-js-sdk/src/randomstring';
|
||||
|
||||
import { _t } from '../../../languageHandler';
|
||||
import Modal from '../../../Modal';
|
||||
|
@ -45,10 +46,9 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
|
|||
constructor(props: IBodyProps) {
|
||||
super(props);
|
||||
|
||||
const randomString = Math.random().toString(16).slice(2, 10);
|
||||
// multiple instances of same map might be in document
|
||||
// eg thread and main timeline, reply
|
||||
const idSuffix = `${props.mxEvent.getId()}_${randomString}`;
|
||||
const idSuffix = `${props.mxEvent.getId()}_${randomString(8)}`;
|
||||
this.mapId = `mx_MLocationBody_${idSuffix}`;
|
||||
|
||||
this.state = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue