diff --git a/app/soapbox/features/status/index.tsx b/app/soapbox/features/status/index.tsx index bda274cd13..b513338838 100644 --- a/app/soapbox/features/status/index.tsx +++ b/app/soapbox/features/status/index.tsx @@ -114,7 +114,11 @@ export const getDescendantsIds = createSelector([ }); type DisplayMedia = 'default' | 'hide_all' | 'show_all'; -type RouteParams = { statusId: string }; + +type RouteParams = { + statusId: string + groupId?: string +}; interface IThread { params: RouteParams @@ -515,6 +519,10 @@ const Thread: React.FC = (props) => { children.push(...renderChildren(descendantsIds).toArray()); } + if (status.group && typeof status.group === 'object' && !props.params.groupId) { + return ; + } + return ( diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx index 89a156be44..0e8875c094 100644 --- a/app/soapbox/features/ui/index.tsx +++ b/app/soapbox/features/ui/index.tsx @@ -299,6 +299,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => {features.groups && } {features.groups && } {features.groups && } + {features.groups && } diff --git a/app/soapbox/selectors/index.ts b/app/soapbox/selectors/index.ts index 12cb4df085..4679c11485 100644 --- a/app/soapbox/selectors/index.ts +++ b/app/soapbox/selectors/index.ts @@ -7,6 +7,7 @@ import { import { createSelector } from 'reselect'; import { getSettings } from 'soapbox/actions/settings'; +import { Entities } from 'soapbox/entity-store/entities'; import { getDomain } from 'soapbox/utils/accounts'; import { validId } from 'soapbox/utils/auth'; import ConfigDB from 'soapbox/utils/config-db'; @@ -14,9 +15,10 @@ import { getFeatures } from 'soapbox/utils/features'; import { shouldFilter } from 'soapbox/utils/timelines'; import type { ContextType } from 'soapbox/normalizers/filter'; +import type { ReducerAccount } from 'soapbox/reducers/accounts'; import type { ReducerChat } from 'soapbox/reducers/chats'; import type { RootState } from 'soapbox/store'; -import type { Filter as FilterEntity, Notification } from 'soapbox/types/entities'; +import type { Filter as FilterEntity, Notification, Status, Group } from 'soapbox/types/entities'; const normalizeId = (id: any): string => typeof id === 'string' ? id : ''; @@ -180,11 +182,11 @@ type APIStatus = { id: string, username?: string }; export const makeGetStatus = () => { return createSelector( [ - (state: RootState, { id }: APIStatus) => state.statuses.get(id), - (state: RootState, { id }: APIStatus) => state.statuses.get(state.statuses.get(id)?.reblog || ''), - (state: RootState, { id }: APIStatus) => state.accounts.get(state.statuses.get(id)?.account || ''), - (state: RootState, { id }: APIStatus) => state.accounts.get(state.statuses.get(state.statuses.get(id)?.reblog || '')?.account || ''), - (state: RootState, { id }: APIStatus) => state.groups.items.get(state.statuses.get(id)?.group || ''), + (state: RootState, { id }: APIStatus) => state.statuses.get(id) as Status | undefined, + (state: RootState, { id }: APIStatus) => state.statuses.get(state.statuses.get(id)?.reblog || '') as Status | undefined, + (state: RootState, { id }: APIStatus) => state.accounts.get(state.statuses.get(id)?.account || '') as ReducerAccount | undefined, + (state: RootState, { id }: APIStatus) => state.accounts.get(state.statuses.get(state.statuses.get(id)?.reblog || '')?.account || '') as ReducerAccount | undefined, + (state: RootState, { id }: APIStatus) => state.entities[Entities.GROUPS]?.store[state.statuses.get(id)?.group || ''] as Group | undefined, (_state: RootState, { username }: APIStatus) => username, getFilters, (state: RootState) => state.me, @@ -207,7 +209,7 @@ export const makeGetStatus = () => { statusReblog = undefined; } - return statusBase.withMutations(map => { + return statusBase.withMutations((map: Status) => { map.set('reblog', statusReblog || null); // @ts-ignore :( map.set('account', accountBase || null);