Skip to content

Scope board to iteration

Alexandru Croitor requested to merge scope_board_to_iteration into master

What does this MR do?

This is the BE part that allows to scope an issue board to an iteration or a pre-defined iteration: None, Any, Current. Stores the scoped iteration in boards#iteration_id.

re #196804 (closed)

Database queries of interest

[19] pry(main)> iteration = IterationsFinder.new(User.first, iterations_finder_params).find_by(id: 4)

The usual sql to pull groups in the hierarchy

------- get groups to lookup iterations within
SELECT "namespaces".*
FROM "namespaces"
WHERE "namespaces"."type" = 'Group'
	AND "namespaces"."id" IN (
		WITH RECURSIVE "base_and_ancestors" AS (
				(
					SELECT "namespaces".*
					FROM "namespaces"
					WHERE "namespaces"."type" = 'Group'
						AND "namespaces"."id" = 110
					)
				
				UNION
				
				(
					SELECT "namespaces".*
					FROM "namespaces"
						, "base_and_ancestors"
					WHERE "namespaces"."type" = 'Group'
						AND "namespaces"."id" = "base_and_ancestors"."parent_id"
					)
				)
		SELECT "id"
		FROM "base_and_ancestors" AS "namespaces"
		)

Actual SQL to find the iteration

----- use above sql result to lookup iteration


SELECT "sprints".*
FROM (
	(
		SELECT "sprints".*
		FROM "sprints"
		WHERE "sprints"."project_id" = 21
		)
	
	UNION ALL
	
	(
		SELECT "sprints".*
		FROM "sprints"
		WHERE "sprints"."group_id" IN (107, 108, 109, 110)
		)
	) sprints
WHERE "sprints"."id" = 4 LIMIT 1

SQL to find iteration within gitlab project

explain SELECT "sprints".*
FROM (
	(
		SELECT "sprints".*
		FROM "sprints"
		WHERE "sprints"."project_id" = 278964
		)
	UNION ALL
	(
		SELECT "sprints".*
		FROM "sprints"
		WHERE "sprints"."group_id" IN (9970)
		)
	) sprints
WHERE "sprints"."id" = 5583 LIMIT 1

Screenshots (strongly suggested)

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
Edited by Alexandru Croitor

Merge request reports

Loading