Skip to content

Allow to unassign Issues and Merge Requests when member leaves team

What does this MR do?

https://gitlab.com/gitlab-org/gitlab/-/issues/36720#proposed-fix: When a user leaves the team add the option to unassign them from any issues or merge requests within that team either either at project or group level

Database query when user(me) leaves the gitlab-org group:

explain

DELETE
FROM "issue_assignees"
WHERE "issue_assignees"."user_id" = 3483274
	AND "issue_assignees"."issue_id" IN (
		SELECT "issues"."id"
		FROM "issues"
		WHERE "issues"."project_id" IN (
				SELECT "projects"."id"
				FROM "projects"
				INNER JOIN routes rs ON rs.source_id = projects.id
					AND rs.source_type = 'Project'
				WHERE (rs.path LIKE 'gitlab-org/%')
				)
		)

Click to see the plan

ModifyTable on public.issue_assignees  (cost=2.00..480.13 rows=2 width=24) (actual time=904.081..904.081 rows=0 loops=1)
   Buffers: shared hit=1113 read=384 dirtied=89
   I/O Timings: read=889.396
   ->  Nested Loop Semi Join  (cost=2.00..480.13 rows=2 width=24) (actual time=47.146..900.985 rows=85 loops=1)
         Buffers: shared hit=971 read=383 dirtied=13
         I/O Timings: read=888.319
         ->  Index Scan using index_issue_assignees_on_user_id on public.issue_assignees  (cost=0.43..85.66 rows=84 width=10) (actual time=8.534..158.008 rows=90 loops=1)
               Index Cond: (issue_assignees.user_id = 3483274)
               Buffers: shared read=94 dirtied=11
               I/O Timings: read=156.797
         ->  Nested Loop Semi Join  (cost=1.56..4.69 rows=1 width=22) (actual time=8.250..8.250 rows=1 loops=90)
               Buffers: shared hit=971 read=289 dirtied=2
               I/O Timings: read=731.522
               ->  Index Scan using issues_pkey on public.issues  (cost=0.56..3.58 rows=1 width=14) (actual time=6.452..6.453 rows=1 loops=90)
                     Index Cond: (issues.id = issue_assignees.issue_id)
                     Buffers: shared hit=211 read=239 dirtied=1
                     I/O Timings: read=575.571
               ->  Nested Loop  (cost=1.00..1.09 rows=1 width=20) (actual time=1.790..1.790 rows=1 loops=90)
                     Buffers: shared hit=760 read=50 dirtied=1
                     I/O Timings: read=155.951
                     ->  Index Scan using projects_pkey on public.projects  (cost=0.43..0.48 rows=1 width=10) (actual time=0.723..0.723 rows=1 loops=90)
                           Index Cond: (projects.id = issues.project_id)
                           Buffers: shared hit=336 read=24 dirtied=1
                           I/O Timings: read=63.233
                     ->  Index Scan using index_routes_on_source_type_and_source_id on public.routes rs  (cost=0.56..0.60 rows=1 width=10) (actual time=1.059..1.059 rows=1 loops=90)
                           Index Cond: (((rs.source_type)::text = 'Project'::text) AND (rs.source_id = issues.project_id))
                           Filter: ((rs.path)::text ~~ 'gitlab-org/%'::text)
                           Rows Removed by Filter: 0
                           Buffers: shared hit=424 read=26
                           I/O Timings: read=92.718
Time: 906.288 ms
  - planning: 2.081 ms
  - execution: 904.207 ms
    - I/O read: 889.396 ms
    - I/O write: 0.000 ms
Shared buffers:

hits: 1113 (~8.70 MiB) from the buffer pool
reads: 384 (~3.00 MiB) from the OS file cache, including disk I/O
dirtied: 89 (~712.00 KiB)
writes: 0

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

re #36720

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading