fix: Broken routing form public links(old links) on migrating the owner user to an organization (#13416)

* Fix routing-form access restrictions

* Update packages/app-store/routing-forms/pages/routing-link/[...appPages].tsx

Co-authored-by: Carina Wollendorfer <[email protected]>

* Fix routing form access issue for users who are never migrated

* Improve comment

* wip

* Fix event-type listing not working

* Automatic reload of the app when being added to a different organization

---------

Co-authored-by: Carina Wollendorfer <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-02-05 15:51:30 +00:00
1 parent 63f537a08f
commit 4fe75771b8
10 files changed
+392 -48

No files matched your search

@@ -58,6 +58,7 @@ export default function TeamListItem(props: Props) {
const searchParams = useCompatSearchParams();
const { t, i18n } = useLocale();
const utils = trpc.useContext();
const user = trpc.viewer.me.useQuery().data;
const team = props.team;
const showDialog = searchParams?.get("inviteModal") === "true";
@@ -68,12 +69,19 @@ export default function TeamListItem(props: Props) {
const inviteMemberMutation = trpc.viewer.teams.inviteMember.useMutation();
const acceptOrLeaveMutation = trpc.viewer.teams.acceptOrLeave.useMutation({
onSuccess: () => {
onSuccess: (_data, variables) => {
showToast(t("success"), "success");
utils.viewer.teams.get.invalidate();
utils.viewer.teams.list.invalidate();
utils.viewer.teams.hasTeamPlan.invalidate();
utils.viewer.teams.listInvites.invalidate();
const userOrganizationId = user?.profile?.organization?.id;
const isSubTeamOfDifferentOrg = team.parentId ? team.parentId != userOrganizationId : false;
const isDifferentOrg = isOrganization({ team }) && team.id !== userOrganizationId;
// If the user team being accepted is a sub-team of different organization or the different organization itself then page must be reloaded to let the session change reflect reliably everywhere.
if (variables.accept && (isSubTeamOfDifferentOrg || isDifferentOrg)) {
window.location.reload();
}
},
});