Back

Extra members showing up on Teams?

  • 0
  • Web
  • Cloud
Yuzu
20 Mar, 2025, 17:45

Hi, relatively new here. Recently got teams working. I am using Vue clientside to invite team members with email link.

Problem: Playing around with 2 users, call them A and B. When A creates a team, it shows 1 member (A). When A sends invite to B, it shows 2 members (B shows not joined) When B clicks on the email link and joins with updateMembershipStatus(), it now shows 3 members total (as seen in pic) but the members list only shows 2.

I can show some of my code This is on my accept invite view component

TypeScript
onMounted(async () => {
  const user = useUserStore();
  console.log("AcceptInviteView user.current:", user.current);
  if (!user.current) return;
  const userId = route.query.userId;
  const secret = route.query.secret;
  const membershipId = route.query.membershipId;
  const teamId = route.query.teamId;

  try {
    await teams.updateMembershipStatus(teamId, membershipId, userId, secret);
    message.value = "You have successfully joined the team!";
    setTimeout(() => router.push("/"), 3000);
  } catch (error) {
    console.error("Membership confirmation failed:", error);
    message.value = "Failed to accept the invite.";
  }
});

Here is my router beforeEach function which I use to direct users to login if they are not logged in but keep the redirect link as a query param. I tried without logging in but seems you have to be logged in to accept the invite?

TypeScript
router.beforeEach(async (to) => {
  const user = useUserStore()

  if (user.current === null) {
    await user.init() 
    console.log('User data loaded')
  }

  if (to.name === 'accept-invite' && user.current === null) {
    console.log('User is not logged in and accepting invite')
    return {
      name: 'login',
      query: { redirect: to.fullPath }, 
    }
  } else if (to.name !== 'login' && user.current === null) {
    console.log('User is not logged in')
    return { name: 'login' }
  }
  if (user.current && to.name === 'login') {
    return { name: 'home' }
  }
})
TL;DR
Developers are having an issue where extra members are showing up on Teams. When inviting a new member, the count increases but the members list doesn't reflect this accurately. The issue occurs after the new member joins. The code shared on the accept invite view component and router beforeEach function might be connected to the problem. The solution might involve reviewing the logic related to updating membership status, userId, secret, and teamId within the code.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more