Page MenuHomePhabricator

Only show direct Phabricator project memberships
Closed, ResolvedPublic

Description

TC currently shows the parent projects of a user's project memberships in the project list (e.g. https://techcontribs.toolforge.org/uid/chlod#phabricator shows "Cloud Services" and "Tools", whereas @Chlod only shows "Tool-techcontribs"). This isn't ideal since someone in a project might not necessarily have access to its parent projects. It also doesn't have parity with what Phabricator shows on its interface, which is an unspoken goal for TC.

project.search doesn't seem to provide an option for a members constraint where the user is a direct project member, nor does that info seem to be available from the members attachment (it only ever returns an object of type {phid: string}). Scrolling through https://phabricator.wikimedia.org/conduit/, there doesn't seem to be any other API endpoint which allows getting a user's joined groups aside from project.query (which is Frozen), but that doesn't give the proper info either (result.data[*].members is just an array of PHIDs). Based on this, an upstream change might be needed.

Event Timeline

Chlod triaged this task as Medium priority.Oct 2 2024, 9:44 AM

I'm pretty sure you can only be a member of a project that does not have any subprojects so you could check that? (Or not? project.search does not seem to expose that information..)

Great to know! You're right about the members thing; parent projects can't have direct members.

No Direct Members: Parent projects can not have members of their own. Instead, all of the users who are members of any subproject count as members of the parent project. By joining (or leaving) a subproject, a user is implicitly added to (or removed from) all ancestors of that project.

I've though of a possible solution to this now. Thanks for the lead! :D

Chlod claimed this task.

Done with f170aaf7abaf4a834fdd10d0a7deb463bd3f3a5f, deployed just now.