Merge branch 'redirect-group-posts' into 'develop'

Redirect group statuses to a custom path

See merge request soapbox-pub/soapbox!2371
This commit is contained in:
Alex Gleason
2023-03-22 16:02:58 +00:00
3 changed files with 19 additions and 8 deletions

View File

@ -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<IThread> = (props) => {
children.push(...renderChildren(descendantsIds).toArray());
}
if (status.group && typeof status.group === 'object' && !props.params.groupId) {
return <Redirect to={`/groups/${status.group.id}/posts/${props.params.statusId}`} />;
}
return (
<Column label={intl.formatMessage(titleMessage, { username })} transparent>
<PullToRefresh onRefresh={handleRefresh}>

View File

@ -299,6 +299,7 @@ const SwitchingColumnsArea: React.FC<ISwitchingColumnsArea> = ({ children }) =>
{features.groups && <WrappedRoute path='/groups/:id/manage' exact page={DefaultPage} component={ManageGroup} content={children} />}
{features.groups && <WrappedRoute path='/groups/:id/manage/blocks' exact page={DefaultPage} component={GroupBlockedMembers} content={children} />}
{features.groups && <WrappedRoute path='/groups/:id/manage/requests' exact page={DefaultPage} component={GroupMembershipRequests} content={children} />}
{features.groups && <WrappedRoute path='/groups/:groupId/posts/:statusId' exact page={StatusPage} component={Status} content={children} />}
<WrappedRoute path='/statuses/new' page={DefaultPage} component={NewStatus} content={children} exact />
<WrappedRoute path='/statuses/:statusId' exact page={StatusPage} component={Status} content={children} />