Update group URLs to use slugs

This commit is contained in:
Alex Gleason
2023-04-17 15:42:08 -04:00
parent 1bce61182c
commit f2d5b2eaef
12 changed files with 27 additions and 21 deletions

View File

@@ -119,6 +119,7 @@ type DisplayMedia = 'default' | 'hide_all' | 'show_all';
type RouteParams = {
statusId: string
groupId?: string
groupSlug?: string
};
interface IThread {
@@ -517,8 +518,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}`} />;
if (status.group && typeof status.group === 'object') {
if (status.group.slug && !props.params.groupSlug) {
return <Redirect to={`/group/${status.group.slug}/posts/${props.params.statusId}`} />;
}
}
const titleMessage = () => {