Skip to content

Commit

Permalink
Added override functionality for github issues links (#1594)
Browse files Browse the repository at this point in the history
  • Loading branch information
daveoconnor authored Jan 13, 2025
1 parent 929fc48 commit 4b8b554
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions libraries/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@
"consider contributing one."
)

LIBRARY_GITHUB_URL_OVERRIDES = {
# library.slug: url
"outcome": "https://github.com/ned14/outcome/issues",
}

DEFAULT_LIBRARIES_LANDING_VIEW = "grid"
SELECTED_BOOST_VERSION_COOKIE_NAME = "boost_version"
SELECTED_LIBRARY_VIEW_COOKIE_NAME = "library_view"
Expand Down
6 changes: 5 additions & 1 deletion libraries/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from core.asciidoc import convert_adoc_to_html
from libraries.managers import IssueManager
from mailing_list.models import EmailData
from .constants import LIBRARY_GITHUB_URL_OVERRIDES

from .utils import generate_random_string, write_content_to_tempfile

Expand Down Expand Up @@ -339,7 +340,10 @@ def github_issues_url(self):
if not self.github_owner or not self.github_repo:
raise ValueError("Invalid GitHub owner or repository")

return f"https://github.com/{self.github_owner}/{self.github_repo}/issues"
return LIBRARY_GITHUB_URL_OVERRIDES.get(
self.slug,
f"https://github.com/{self.github_owner}/{self.github_repo}/issues",
)


class LibraryVersion(models.Model):
Expand Down
11 changes: 11 additions & 0 deletions libraries/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ def test_get_issues_link(library):
assert expected == result


def test_get_issues_link_override():
outcome_library = baker.make(
"libraries.Library",
name="Outcome",
slug="outcome",
github_url="https://github.com/boostorg/outcome",
)
expected = "https://github.com/ned14/outcome/issues"
assert outcome_library.github_issues_url == expected


def test_category_creation(category):
assert category.name is not None

Expand Down

0 comments on commit 4b8b554

Please sign in to comment.