Skip to content

Commit 29ab345

Browse files
authored
Small improvements on PR previews handling (#12061)
- When a PR preview is re-opened, make sure to reset its status as active - When closing a PR we don't need to take into consideration the commit, we act based on the ID only. Extracted from #11942
1 parent 40f7f02 commit 29ab345

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

readthedocs/core/views/hooks.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def get_or_create_external_version(project, version_data):
150150
external_version.identifier = version_data.commit
151151
# If the PR was previously closed it was marked as closed
152152
external_version.state = EXTERNAL_VERSION_STATE_OPEN
153+
external_version.active = True
153154
external_version.save()
154155
log.info(
155156
"External version updated.",
@@ -172,12 +173,7 @@ def close_external_version(project, version_data):
172173
:rtype: str
173174
"""
174175
external_version = (
175-
project.versions(manager=EXTERNAL)
176-
.filter(
177-
verbose_name=version_data.id,
178-
identifier=version_data.commit,
179-
)
180-
.first()
176+
project.versions(manager=EXTERNAL).filter(verbose_name=version_data.id).first()
181177
)
182178

183179
if external_version:

0 commit comments

Comments
 (0)