Update start trial CTA in top right banner to only appear if all namespaces are free
requested to merge 36402-update-start-trial-cta-in-top-right-banner-to-only-appear-if-all-namespaces-are-free into master
What does this MR do?
Issue #36402 (closed)
We want to exclude any user from seeing this CTA
- if either their personal namespace
- or any group they are associated with at least reporter access is on a paid tier (Bronze, Silver or Gold).
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Database
explain SELECT 1 AS one
FROM (
(SELECT "namespaces"."plan_id"
FROM "namespaces"
WHERE "namespaces"."type" IS NULL
AND "namespaces"."owner_id" = 4409816)
UNION
(SELECT "namespaces"."plan_id"
FROM "namespaces"
INNER JOIN "members" ON "namespaces"."id" = "members"."source_id"
WHERE "members"."type" IN ('GroupMember')
AND "members"."source_type" = 'Namespace'
AND "namespaces"."type" IN ('Group')
AND "members"."user_id" = 4409816
AND "members"."requested_at" IS NULL
AND "members"."access_level" IN (20,
30,
40,
50)
AND "namespaces"."parent_id" IS NULL)) namespaces
WHERE "namespaces"."plan_id" IN
(SELECT "plans"."id"
FROM "plans"
WHERE "plans"."name" IN ('bronze',
'silver',
'gold'))
LIMIT 1;
https://explain.depesz.com/s/pVJr
Limit (cost=31.11..33.21 rows=1 width=4) (actual time=0.266..0.268 rows=1 loops=1)
Buffers: shared hit=48
-> Nested Loop (cost=31.11..35.32 rows=2 width=4) (actual time=0.265..0.265 rows=1 loops=1)
Buffers: shared hit=48
-> Seq Scan on public.plans (cost=0.00..4.08 rows=3 width=4) (actual time=0.028..0.030 rows=3 loops=1)
Filter: ((plans.name)::text = ANY ('{bronze,silver,gold}'::text[]))
Rows Removed by Filter: 2
Buffers: shared hit=1
-> Materialize (cost=31.11..31.15 rows=2 width=4) (actual time=0.074..0.076 rows=2 loops=3)
Buffers: shared hit=47
-> Unique (cost=31.11..31.12 rows=2 width=4) (actual time=0.216..0.221 rows=3 loops=1)
Buffers: shared hit=47
-> Sort (cost=31.11..31.12 rows=2 width=4) (actual time=0.215..0.216 rows=7 loops=1)
Sort Key: namespaces.plan_id
Sort Method: quicksort Memory: 25kB
Buffers: shared hit=47
-> Append (cost=0.43..31.10 rows=2 width=4) (actual time=0.013..0.161 rows=7 loops=1)
Buffers: shared hit=44
-> Index Scan using index_namespaces_on_owner_id on public.namespaces (cost=0.43..4.45 rows=1 width=4) (actual time=0.013..0.014 rows=1 loops=1)
Index Cond: (namespaces.owner_id = 4409816)
Filter: (namespaces.type IS NULL)
Rows Removed by Filter: 0
Buffers: shared hit=4
-> Nested Loop (cost=0.87..26.63 rows=1 width=4) (actual time=0.047..0.146 rows=6 loops=1)
Buffers: shared hit=40
-> Index Scan using index_members_on_user_id on public.members (cost=0.43..22.17 rows=1 width=4) (actual time=0.028..0.064 rows=6 loops=1)
Index Cond: (members.user_id = 4409816)
Filter: ((members.requested_at IS NULL) AND ((members.type)::text = 'GroupMember'::text) AND ((members.source_type)::text = 'Namespace'::text) AND (members.access_level = ANY ('{20,30,40,50}'::integer[])))
Rows Removed by Filter: 7
Buffers: shared hit=16
-> Index Scan using namespaces_pkey on public.namespaces namespaces_1 (cost=0.43..4.45 rows=1 width=8) (actual time=0.012..0.012 rows=1 loops=6)
Index Cond: (namespaces_1.id = members.source_id)
Filter: ((namespaces_1.parent_id IS NULL) AND ((namespaces_1.type)::text = 'Group'::text))
Rows Removed by Filter: 0
Buffers: shared hit=24
Summary:
Time: 5.465 ms
- planning: 5.069 ms
- execution: 0.396 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 48 (~384.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
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 Alper Akgun