Refactor <Header> into TypeScript (#33956)

This commit is contained in:
Eugen Rochko 2025-02-25 16:30:46 +01:00 committed by GitHub
parent 20531d1e07
commit ebde60ca82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 1121 additions and 859 deletions

View file

@ -1,6 +1,7 @@
import { createSelector } from '@reduxjs/toolkit';
import { Record as ImmutableRecord } from 'immutable';
import { me } from 'mastodon/initial_state';
import { accountDefaultValues } from 'mastodon/models/account';
import type { Account, AccountShape } from 'mastodon/models/account';
import type { Relationship } from 'mastodon/models/relationship';
@ -45,3 +46,16 @@ export function makeGetAccount() {
},
);
}
export const getAccountHidden = createSelector(
[
(state: RootState, id: string) => state.accounts.get(id)?.hidden,
(state: RootState, id: string) =>
state.relationships.get(id)?.following ||
state.relationships.get(id)?.requested,
(state: RootState, id: string) => id === me,
],
(hidden, followingOrRequested, isSelf) => {
return hidden && !(isSelf || followingOrRequested);
},
);