Skip to content

Commit e82423b

Browse files
authored
Project: add is_github_app_project helper method (#12193)
This is also going to be used in the templates
1 parent daba7d7 commit e82423b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

readthedocs/projects/forms.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from readthedocs.core.utils.extend import SettingsOverrideObject
2626
from readthedocs.integrations.models import Integration
2727
from readthedocs.invitations.models import Invitation
28-
from readthedocs.oauth.constants import GITHUB_APP
2928
from readthedocs.oauth.models import RemoteRepository
3029
from readthedocs.organizations.models import Team
3130
from readthedocs.projects.constants import ADDONS_FLYOUT_SORTING_CUSTOM_PATTERN
@@ -231,8 +230,7 @@ def clean_prevalidation(self):
231230
"""Disable the external builds option if the project doesn't meet the requirements."""
232231
# If the project is attached to a GitHub app integration,
233232
# it will always be able to build external versions.
234-
remote_repository = self.instance.remote_repository
235-
if remote_repository and remote_repository.vcs_provider == GITHUB_APP:
233+
if self.instance.is_github_app_project:
236234
return
237235

238236
integrations = list(self.instance.integrations.all())

readthedocs/projects/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from readthedocs.domains.querysets import DomainQueryset
4141
from readthedocs.domains.validators import check_domains_limit
4242
from readthedocs.notifications.models import Notification as NewNotification
43+
from readthedocs.oauth.constants import GITHUB_APP
4344
from readthedocs.projects import constants
4445
from readthedocs.projects.exceptions import ProjectConfigurationError
4546
from readthedocs.projects.managers import HTMLFileManager
@@ -1013,6 +1014,10 @@ def is_github_project(self):
10131014
GitHubAppService,
10141015
]
10151016

1017+
@property
1018+
def is_github_app_project(self):
1019+
return self.remote_repository and self.remote_repository.vcs_provider == GITHUB_APP
1020+
10161021
@property
10171022
def is_gitlab_project(self):
10181023
from readthedocs.oauth.services import GitLabService

0 commit comments

Comments
 (0)