File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 11"""This module contains the logic to help users migrate from the GitHub OAuth App to the GitHub App."""
22
33from dataclasses import dataclass
4+ from functools import cached_property
45from typing import Iterator
56from urllib .parse import urlencode
67
1415from readthedocs .oauth .constants import GITHUB
1516from readthedocs .oauth .constants import GITHUB_APP
1617from readthedocs .oauth .models import GitHubAccountType
18+ from readthedocs .oauth .models import GitHubAppInstallation
1719from readthedocs .oauth .models import RemoteRepository
1820from readthedocs .oauth .services import GitHubAppService
1921from readthedocs .oauth .services import GitHubService
@@ -30,6 +32,13 @@ class GitHubAccountTarget:
3032 avatar_url : str
3133 profile_url : str
3234
35+ @cached_property
36+ def has_installation (self ) -> bool :
37+ """Check if the GitHub App is installed in this account."""
38+ return GitHubAppInstallation .objects .filter (
39+ target_id = self .id , target_type = self .type
40+ ).exists ()
41+
3342
3443@dataclass
3544class InstallationTargetGroup :
You can’t perform that action at this time.
0 commit comments