Profile redesign: Show yourself in follower list (#37813)
This commit is contained in:
13 files changed
+474
-375
No files matched your search
@@ -47,5 +47,5 @@ export function toTypedTimeline(timeline?: ImmutableMap<string, unknown>) {
|
||||
emptyList,
|
||||
) as ImmutableList<string>,
|
||||
items: timeline.get('items', emptyList) as ImmutableList<string>,
|
||||
} as TimelineShape;
|
||||
} satisfies TimelineShape;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { Map as ImmutableMap } from 'immutable';
|
||||
import { List as ImmutableList } from 'immutable';
|
||||
|
||||
import { createAppSelector } from '../store';
|
||||
|
||||
export const selectUserListWithoutMe = createAppSelector(
|
||||
[
|
||||
(state) => state.user_lists,
|
||||
(state) => (state.meta.get('me') as string | null) ?? null,
|
||||
(_state, listName: string) => listName,
|
||||
(_state, _listName, accountId?: string | null) => accountId ?? null,
|
||||
],
|
||||
(lists, currentAccountId, listName, accountId) => {
|
||||
if (!accountId || !listName) {
|
||||
return null;
|
||||
}
|
||||
const list = lists.getIn([listName, accountId]) as
|
||||
| ImmutableMap<string, unknown>
|
||||
| undefined;
|
||||
if (!list) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Returns the list except the current account.
|
||||
return {
|
||||
items: (
|
||||
list.get('items', ImmutableList<string>()) as ImmutableList<string>
|
||||
)
|
||||
.filter((id) => id !== currentAccountId)
|
||||
.toArray(),
|
||||
isLoading: !!list.get('isLoading', true),
|
||||
hasMore: !!list.get('hasMore', false),
|
||||
};
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user