Skip to content

Commit acaf4e0

Browse files
authored
Use context data instead of one off template tags (#12506)
We will be inspecting more than just existance of the GHA provider, it's easier to just have a simple lookup list than tags for each provider for this. The tag removed is not used anymore now, context data is used instead. - Required by ext-theme#648
1 parent 202dfc5 commit acaf4e0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

readthedocs/core/templatetags/readthedocs/socialaccounts.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,3 @@ def has_github_app_account(account):
4141
provider=GitHubAppProvider.id,
4242
uid=account.uid,
4343
).exists()
44-
45-
46-
@register.filter
47-
def user_has_github_app_account(user):
48-
"""Check if a user has a GitHub App account."""
49-
return user.socialaccount_set.filter(provider=GitHubAppProvider.id).exists()

readthedocs/projects/views/private.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,12 @@ def get_context_data(self, **kwargs):
461461
context["form_manual"] = ProjectManualForm(user=self.request.user)
462462
context["GITHUB_APP_NAME"] = settings.GITHUB_APP_NAME
463463

464+
# Provider list for simple lookup of connected services, used for
465+
# conditional content
466+
context["socialaccount_providers"] = self.request.user.socialaccount_set.values_list(
467+
"provider", flat=True
468+
)
469+
464470
return context
465471

466472

0 commit comments

Comments
 (0)