[Glitch] Use a modern React context for identity in the app

Port a178ba7cd5 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Renaud Chaput 2024-05-19 19:07:32 +02:00 committed by Claire
commit ca5955ed76
27 changed files with 215 additions and 230 deletions

View file

@ -19,6 +19,7 @@ import NotificationsIcon from '@/material-icons/400-24px/notifications-fill.svg?
import { compareId } from 'flavours/glitch/compare_id';
import { Icon } from 'flavours/glitch/components/icon';
import { NotSignedInIndicator } from 'flavours/glitch/components/not_signed_in_indicator';
import { identityContextPropShape, withIdentity } from 'flavours/glitch/identity_context';
import { addColumn, removeColumn, moveColumn } from '../../actions/columns';
import { submitMarkers } from '../../actions/markers';
@ -93,12 +94,8 @@ const mapDispatchToProps = dispatch => ({
});
class Notifications extends PureComponent {
static contextTypes = {
identity: PropTypes.object,
};
static propTypes = {
identity: identityContextPropShape,
columnId: PropTypes.string,
notifications: ImmutablePropTypes.list.isRequired,
showFilterBar: PropTypes.bool.isRequired,
@ -225,7 +222,7 @@ class Notifications extends PureComponent {
const { animatingNCD } = this.state;
const pinned = !!columnId;
const emptyMessage = <FormattedMessage id='empty_column.notifications' defaultMessage="You don't have any notifications yet. When other people interact with you, you will see it here." />;
const { signedIn } = this.context.identity;
const { signedIn } = this.props.identity;
let scrollableContent = null;
@ -373,4 +370,4 @@ class Notifications extends PureComponent {
}
export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(Notifications));
export default connect(mapStateToProps, mapDispatchToProps)(withIdentity(injectIntl(Notifications)));