File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6262 NestedEnvironmentPermissions ,
6363)
6464from features .value_types import BOOLEAN , INTEGER , STRING
65+ from integrations .flagsmith .client import get_client
6566from projects .code_references .services import (
6667 annotate_feature_queryset_with_code_references_summary ,
67- is__code_references_ui_stats__enabled ,
6868)
6969from projects .models import Project
7070from users .models import FFAdminUser , UserPermissionGroup
@@ -221,7 +221,13 @@ def get_queryset(self): # type: ignore[no-untyped-def]
221221 query_data = query_serializer .validated_data
222222
223223 # TODO: Delete this after https://github.com/flagsmith/flagsmith/issues/6832 is resolved
224- if is__code_references_ui_stats__enabled (project .organisation ):
224+ organisation = project .organisation
225+ flagsmith_client = get_client ("local" , local_eval = True )
226+ flags = flagsmith_client .get_identity_flags (
227+ organisation .flagsmith_identifier ,
228+ traits = organisation .flagsmith_on_flagsmith_api_traits ,
229+ )
230+ if flags .is_feature_enabled ("code_references_ui_stats" ):
225231 queryset = annotate_feature_queryset_with_code_references_summary (queryset )
226232 else :
227233 queryset = queryset .annotate (
Original file line number Diff line number Diff line change 1- import typing
21from datetime import timedelta
32from urllib .parse import urljoin
43
1615from django .utils import timezone
1716
1817from features .models import Feature
19- from integrations .flagsmith .client import get_client
2018from projects .code_references .constants import (
2119 FEATURE_FLAG_CODE_REFERENCES_RETENTION_DAYS ,
2220)
2725 VCSProvider ,
2826)
2927
30- if typing .TYPE_CHECKING :
31- from organisations .models import Organisation
32-
33-
34- def is__code_references_ui_stats__enabled (organisation : "Organisation" ) -> bool :
35- """Check if code reference UI stats are enabled for an organisation.
36-
37- TODO: Delete this after https://github.com/flagsmith/flagsmith/issues/6832 is resolved.
38- """
39- flagsmith_client = get_client ("local" , local_eval = True )
40- flags = flagsmith_client .get_identity_flags (
41- organisation .flagsmith_identifier ,
42- traits = organisation .flagsmith_on_flagsmith_api_traits ,
43- )
44- return flags .is_feature_enabled ("code_references_ui_stats" )
45-
4628
4729def annotate_feature_queryset_with_code_references_summary (
4830 queryset : QuerySet [Feature ],
You can’t perform that action at this time.
0 commit comments