mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 16:59:41 +00:00
[Glitch] Refactor <Header> into TypeScript
Port ebde60ca82 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { Record as ImmutableRecord } from 'immutable';
|
||||
|
||||
import { me } from 'flavours/glitch/initial_state';
|
||||
import { accountDefaultValues } from 'flavours/glitch/models/account';
|
||||
import type { Account, AccountShape } from 'flavours/glitch/models/account';
|
||||
import type { Relationship } from 'flavours/glitch/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);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user