Skip to content

Commit 22ff74d

Browse files
authored
Merge branch 'main' into dashboard/metrics-details-frontend
2 parents c06e6bf + 926bd33 commit 22ff74d

File tree

25 files changed

+151
-137
lines changed

25 files changed

+151
-137
lines changed

backend/apps/common/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_absolute_url(path: str) -> str:
5555
str: The absolute URL.
5656
5757
"""
58-
return f"{settings.SITE_URL}/{path}"
58+
return f"{settings.SITE_URL}/{path.lstrip('/')}"
5959

6060

6161
def get_nest_user_agent() -> str:

backend/apps/github/models/user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def issues(self):
5757
@property
5858
def nest_url(self) -> str:
5959
"""Get Nest URL for user."""
60-
return get_absolute_url(f"members/{self.nest_key}")
60+
return get_absolute_url(f"/members/{self.nest_key}")
6161

6262
@property
6363
def releases(self):
@@ -94,7 +94,7 @@ def from_github(self, gh_user) -> None:
9494

9595
def get_absolute_url(self):
9696
"""Get absolute URL for the user."""
97-
return self.nest_url
97+
return f"/members/{self.nest_key}"
9898

9999
@staticmethod
100100
def bulk_save(users, fields=None) -> None:

backend/apps/owasp/models/project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def nest_key(self) -> str:
175175
@property
176176
def nest_url(self) -> str:
177177
"""Get Nest URL for project."""
178-
return get_absolute_url(f"projects/{self.nest_key}")
178+
return get_absolute_url(f"/projects/{self.nest_key}")
179179

180180
@property
181181
def open_issues(self):
@@ -306,7 +306,7 @@ def from_github(self, repository) -> None:
306306

307307
def get_absolute_url(self):
308308
"""Get absolute URL for project."""
309-
return self.nest_url
309+
return f"/projects/{self.nest_key}"
310310

311311
def save(self, *args, **kwargs) -> None:
312312
"""Save the project instance."""

backend/apps/sitemap/views/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class BaseSitemap(Sitemap):
88

99
change_frequency = "weekly"
1010
prefix = ""
11+
protocol = "https"
1112

1213
STATIC_ROUTES = (
1314
{"path": "/chapters", "changefreq": "weekly", "priority": 0.8},

backend/apps/sitemap/views/member.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
"""Member sitemap."""
22

3-
from django.contrib.sitemaps import Sitemap
4-
53
from apps.github.models.user import User
4+
from apps.sitemap.views.base import BaseSitemap
65

76

8-
class MemberSitemap(Sitemap):
7+
class MemberSitemap(BaseSitemap):
98
"""Member sitemap."""
109

1110
prefix = "/members"

backend/apps/sitemap/views/project.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
"""Project sitemap."""
22

3-
from django.contrib.sitemaps import Sitemap
4-
53
from apps.owasp.models.project import Project
4+
from apps.sitemap.views.base import BaseSitemap
65

76

8-
class ProjectSitemap(Sitemap):
7+
class ProjectSitemap(BaseSitemap):
98
"""Project sitemap."""
109

1110
prefix = "/projects"

backend/apps/slack/commands/community.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ def get_template_context(self, command: dict):
2424
return {
2525
**super().get_template_context(command),
2626
"name": "OWASP community",
27-
"url": get_absolute_url("members"),
27+
"url": get_absolute_url("/members"),
2828
}

backend/apps/slack/commands/gsoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def get_template_context(self, command: dict):
4949
"mode": "general",
5050
"nest_bot_name": NEST_BOT_NAME,
5151
"previous_year": gsoc_year,
52-
"projects_url": get_absolute_url("projects"),
52+
"projects_url": get_absolute_url("/projects"),
5353
}
5454
)
5555
elif command_text.isnumeric():

backend/apps/slack/commands/leaders.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def get_template_context(self, command: dict):
4646
"idx_key": chapter["idx_key"],
4747
"idx_leaders": chapter["idx_leaders"],
4848
"idx_name": chapter["idx_name"],
49-
"url": get_absolute_url(f"chapters/{chapter['idx_key']}"),
49+
"url": get_absolute_url(f"/chapters/{chapter['idx_key']}"),
5050
}
5151
for chapter in chapters
5252
]
@@ -55,7 +55,7 @@ def get_template_context(self, command: dict):
5555
"idx_key": project["idx_key"],
5656
"idx_leaders": project["idx_leaders"],
5757
"idx_name": project["idx_name"],
58-
"url": get_absolute_url(f"projects/{project['idx_key']}"),
58+
"url": get_absolute_url(f"/projects/{project['idx_key']}"),
5959
}
6060
for project in projects
6161
]

backend/apps/slack/common/contribute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
)
1212

1313
project_issues_url = get_absolute_url("/contribute")
14-
projects_url = get_absolute_url("projects")
14+
projects_url = get_absolute_url("/projects")
1515

1616
CONTRIBUTE_GENERAL_INFORMATION_BLOCKS = (
1717
markdown(

0 commit comments

Comments
 (0)