Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(flags): allow overrides for disabled flags #18408

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7a838f9
fix(flags): allow overrides for disabled flags
liyiy Nov 6, 2023
7b826b5
use get_all_feature_flags
liyiy Nov 7, 2023
a01025c
Merge branch 'master' into flags-toolbar
liyiy Nov 7, 2023
867d41a
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
3dd59c9
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
c0769d9
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 7, 2023
bb80c53
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
77dfc9d
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 7, 2023
7e07a6c
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
18f39b6
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 7, 2023
a14643b
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
7e64390
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 7, 2023
fad68a0
Update UI snapshots for `webkit` (2)
github-actions[bot] Nov 7, 2023
4faa641
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
1d4586a
Update UI snapshots for `webkit` (2)
github-actions[bot] Nov 7, 2023
9981619
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
48759a4
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
bcfa7b4
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
8b5a9e0
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 7, 2023
5589d1a
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 7, 2023
d3857e1
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
757fda1
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
ef3c35c
Update UI snapshots for `webkit` (2)
github-actions[bot] Nov 7, 2023
0083c75
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 7, 2023
e105210
Update UI snapshots for `webkit` (2)
github-actions[bot] Nov 7, 2023
fb5bd8a
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
40a1213
Update query snapshots
github-actions[bot] Nov 7, 2023
16fe60c
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
1f82e67
Update query snapshots
github-actions[bot] Nov 7, 2023
6b399e1
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
bad0662
Update query snapshots
github-actions[bot] Nov 7, 2023
4099504
Merge branch 'master' into flags-toolbar
liyiy Nov 7, 2023
0b2acf3
Merge branch 'flags-toolbar' of https://github.com/PostHog/posthog in…
liyiy Nov 7, 2023
a7372a7
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
e0d5043
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 7, 2023
15fab91
Update query snapshots
github-actions[bot] Nov 7, 2023
9198fa7
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
1c7ce8f
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 7, 2023
10cb18a
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
ae8b36d
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-other-billing-v2--billing-v-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion frontend/src/toolbar/flags/featureFlagsLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const featureFlagsLogic = kea<featureFlagsLogicType>([
(userFlags, localOverrides) => {
return userFlags.map((flag) => {
const hasVariants = (flag.feature_flag.filters?.multivariate?.variants?.length || 0) > 0

const currentValue =
flag.feature_flag.key in localOverrides ? localOverrides[flag.feature_flag.key] : flag.value

Expand Down
6 changes: 3 additions & 3 deletions posthog/api/feature_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
from posthog.models.cohort import Cohort
from posthog.models.cohort.util import get_dependent_cohorts
from posthog.models.feature_flag import (
FeatureFlagMatcher,
FeatureFlagDashboards,
can_user_edit_feature_flag,
get_all_feature_flags,
Expand Down Expand Up @@ -460,7 +459,7 @@ def my_flags(self, request: request.Request, **kwargs):
raise exceptions.NotAuthenticated()

feature_flags = (
FeatureFlag.objects.filter(team=self.team, active=True, deleted=False)
FeatureFlag.objects.filter(team=self.team, deleted=False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a follow up, you should also replace L479 with get_all_feature_flags, because right now this gives incorrect responses for some flags because it's missing logic for hash key overrides, for example.

.prefetch_related("experiment_set")
.prefetch_related("features")
.prefetch_related("analytics_dashboards")
Expand All @@ -476,7 +475,8 @@ def my_flags(self, request: request.Request, **kwargs):
if not feature_flag_list:
return Response(flags)

matches, _, _, _ = FeatureFlagMatcher(feature_flag_list, request.user.distinct_id, groups).get_matches()
matches, _, _, _ = get_all_feature_flags(self.team_id, request.user.distinct_id, groups)

for feature_flag in feature_flags:
flags.append(
{
Expand Down
Loading