diff --git a/app/gabsocial/components/status_action_bar.js b/app/gabsocial/components/status_action_bar.js index 45be1a0e6..7c5620876 100644 --- a/app/gabsocial/components/status_action_bar.js +++ b/app/gabsocial/components/status_action_bar.js @@ -3,6 +3,7 @@ import React from 'react'; import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; +import SoapboxPropTypes from 'gabsocial/utils/soapbox_prop_types'; import IconButton from './icon_button'; import DropdownMenuContainer from '../containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; @@ -65,7 +66,7 @@ class StatusActionBar extends ImmutablePureComponent { withDismiss: PropTypes.bool, withGroupAdmin: PropTypes.bool, intl: PropTypes.object.isRequired, - me: PropTypes.string, + me: SoapboxPropTypes.me, isStaff: PropTypes.bool.isRequired, }; diff --git a/app/gabsocial/containers/gabsocial.js b/app/gabsocial/containers/gabsocial.js index 8cec3411d..4319d10e4 100644 --- a/app/gabsocial/containers/gabsocial.js +++ b/app/gabsocial/containers/gabsocial.js @@ -3,6 +3,7 @@ import React from 'react'; import { Provider, connect } from 'react-redux'; import PropTypes from 'prop-types'; +import SoapboxPropTypes from 'gabsocial/utils/soapbox_prop_types'; import Helmet from 'gabsocial/components/helmet'; import classNames from 'classnames'; import configureStore from '../store/configureStore'; @@ -55,7 +56,7 @@ class GabSocialMount extends React.PureComponent { static propTypes = { showIntroduction: PropTypes.bool, - me: PropTypes.string, + me: SoapboxPropTypes.me, theme: PropTypes.string, reduceMotion: PropTypes.bool, systemFont: PropTypes.bool, diff --git a/app/gabsocial/features/status/components/action_bar.js b/app/gabsocial/features/status/components/action_bar.js index 263c800d4..5432dd0e5 100644 --- a/app/gabsocial/features/status/components/action_bar.js +++ b/app/gabsocial/features/status/components/action_bar.js @@ -2,6 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { openModal } from '../../../actions/modal'; import PropTypes from 'prop-types'; +import SoapboxPropTypes from 'gabsocial/utils/soapbox_prop_types'; import IconButton from '../../../components/icon_button'; import ImmutablePropTypes from 'react-immutable-proptypes'; import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; @@ -69,7 +70,7 @@ class ActionBar extends React.PureComponent { onEmbed: PropTypes.func, intl: PropTypes.object.isRequired, onOpenUnauthorizedModal: PropTypes.func.isRequired, - me: PropTypes.string, + me: SoapboxPropTypes.me, isStaff: PropTypes.bool.isRequired, }; diff --git a/app/gabsocial/features/ui/components/sign_up_panel.js b/app/gabsocial/features/ui/components/sign_up_panel.js index de6e9d2c2..1a229ae06 100644 --- a/app/gabsocial/features/ui/components/sign_up_panel.js +++ b/app/gabsocial/features/ui/components/sign_up_panel.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import SoapboxPropTypes from 'gabsocial/utils/soapbox_prop_types'; import { connect } from 'react-redux'; import { FormattedMessage, injectIntl } from 'react-intl'; @@ -36,7 +37,7 @@ const SignUpPanel = ({ siteTitle, me }) => { SignUpPanel.propTypes = { siteTitle: PropTypes.string, - me: PropTypes.string, + me: SoapboxPropTypes.me, }; export default injectIntl(connect(mapStateToProps)(SignUpPanel)); diff --git a/app/gabsocial/features/ui/index.js b/app/gabsocial/features/ui/index.js index cbc5e2c1b..d737e1d10 100644 --- a/app/gabsocial/features/ui/index.js +++ b/app/gabsocial/features/ui/index.js @@ -7,6 +7,7 @@ import { defineMessages, injectIntl } from 'react-intl'; import { connect } from 'react-redux'; import { Switch, withRouter } from 'react-router-dom'; import PropTypes from 'prop-types'; +import SoapboxPropTypes from 'gabsocial/utils/soapbox_prop_types'; import NotificationsContainer from './containers/notifications_container'; import LoadingBarContainer from './containers/loading_bar_container'; import ModalContainer from './containers/modal_container'; @@ -266,7 +267,7 @@ class UI extends React.PureComponent { location: PropTypes.object, intl: PropTypes.object.isRequired, dropdownMenuIsOpen: PropTypes.bool, - me: PropTypes.string, + me: SoapboxPropTypes.me, streamingUrl: PropTypes.string, meUsername: PropTypes.string, }; diff --git a/app/gabsocial/features/ui/util/react_router_helpers.js b/app/gabsocial/features/ui/util/react_router_helpers.js index caf76d09d..fb855ddcb 100644 --- a/app/gabsocial/features/ui/util/react_router_helpers.js +++ b/app/gabsocial/features/ui/util/react_router_helpers.js @@ -1,6 +1,7 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; +import SoapboxPropTypes from 'gabsocial/utils/soapbox_prop_types'; import { Redirect, Route } from 'react-router-dom'; import ColumnsAreaContainer from '../containers/columns_area_container'; import ColumnLoading from '../components/column_loading'; @@ -22,7 +23,7 @@ class WrappedRoute extends React.Component { componentParams: PropTypes.object, layout: PropTypes.object, publicRoute: PropTypes.bool, - me: PropTypes.string, + me: SoapboxPropTypes.me, }; static defaultProps = { diff --git a/app/gabsocial/reducers/me.js b/app/gabsocial/reducers/me.js index c83b0c585..a79780196 100644 --- a/app/gabsocial/reducers/me.js +++ b/app/gabsocial/reducers/me.js @@ -8,9 +8,7 @@ export default function me(state = initialState, action) { case ME_FETCH_SUCCESS: return action.me.id; case ME_FETCH_FAIL: - return false; case ME_FETCH_SKIP: - return false; case AUTH_LOGGED_OUT: return false; default: diff --git a/app/gabsocial/utils/soapbox_prop_types.js b/app/gabsocial/utils/soapbox_prop_types.js new file mode 100644 index 000000000..b7457957c --- /dev/null +++ b/app/gabsocial/utils/soapbox_prop_types.js @@ -0,0 +1,9 @@ +import PropTypes from 'prop-types'; + +export default { + me: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.oneOf([false, null]), + ]), + meLoggedIn: PropTypes.string, +};