You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AbstractInsecureRoomNameLabel.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // @flow
  2. import { PureComponent } from 'react';
  3. import isInsecureRoomName from '../../base/util/isInsecureRoomName';
  4. type Props = {
  5. /**
  6. * True of the label should be visible.
  7. */
  8. _visible: boolean;
  9. /**
  10. * Function to be used to translate i18n labels.
  11. */
  12. t: Function
  13. }
  14. /**
  15. * Abstrsact class for the {@Code InsecureRoomNameLabel} component.
  16. */
  17. export default class AbstractInsecureRoomNameLabel extends PureComponent<Props> {
  18. /**
  19. * Implements {@code Component#render}.
  20. *
  21. * @inheritdoc
  22. */
  23. render() {
  24. if (!this.props._visible) {
  25. return null;
  26. }
  27. return this._render();
  28. }
  29. /**
  30. * Renders the platform dependent content.
  31. *
  32. * @returns {ReactElement}
  33. */
  34. _render: () => Object;
  35. }
  36. /**
  37. * Maps part of the Redux state to the props of this component.
  38. *
  39. * @param {Object} state - The Redux state.
  40. * @returns {Props}
  41. */
  42. export function _mapStateToProps(state: Object): $Shape<Props> {
  43. const { locked, room } = state['features/base/conference'];
  44. const { lobbyEnabled } = state['features/lobby'];
  45. const { enableInsecureRoomNameWarning = false } = state['features/base/config'];
  46. return {
  47. _visible: enableInsecureRoomNameWarning
  48. && room && isInsecureRoomName(room)
  49. && !(lobbyEnabled || Boolean(locked))
  50. };
  51. }