Properly translates GitHub attributes to GitLab

This commit is contained in:
T'rahk Rokym 2025-04-21 12:35:03 +02:00
parent cd9d985732
commit ec34d7fd29
2 changed files with 9 additions and 2 deletions

View File

@ -63,7 +63,7 @@
<span class="badge bg-danger me-2">{% translate "Closed" %}</span>
{% endif %}
<span class="badge bg-info me-2">{{ notif.app_name }}</span>
<a href="{{ notif.web_url }}{{ notif.html_url }}" target="_blank">#{{ notif.iid }}{{ notif.number }} {{ notif.title }}</a>
<a href="{{ notif.web_url }}" target="_blank">#{{ notif.iid }} {{ notif.title }}</a>
</li>
{% endfor %}
</ul>

View File

@ -78,7 +78,14 @@ class AppAnnouncementHook:
f"https://api.github.com/repos/{self.repository_namespace}/issues"
f"?labels={self.label}&state=all"
)
return [element for element in raw_list if not element.get("pull_request")]
# Translates GitHub attributes to GitLab and filters out pull requests
clean_list = []
for element in raw_list:
if not element.get("pull_request"):
element["web_url"] = element["html_url"]
element["iid"] = element["number"]
clean_list.append(element)
return clean_list
def _get_gitlab_announcement_list(self) -> list:
"""Return the issues list for a GitLab repository"""