From ebe499c73c89ccd3d9a81a2971128ee5dd152586 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 17 Sep 2020 20:58:55 +0200 Subject: [PATCH] Add more app data extensions * mailing list * irc * matrix --- src/Model/AppData.php | 39 +++++++++++++++++++++++++--- templates/main/application.html.twig | 15 ++++++++++- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/Model/AppData.php b/src/Model/AppData.php index 46a23f3..97c523b 100644 --- a/src/Model/AppData.php +++ b/src/Model/AppData.php @@ -481,7 +481,9 @@ class AppData */ public function getForum(): string { - if (isset($this->raw['X-KDE-Forum'])) { + if (isset($this->raw['Custom']) && isset($this->raw['Custom']['KDE::forum'])) { + return $this->raw['Custom']['KDE::forum']; + } else if (isset($this->raw['X-KDE-Forum'])) { return 'https://forum.kde.org/viewforum.php?f='.$this->raw['X-KDE-Forum']; } else { return 'https://forum.kde.org/'; @@ -489,12 +491,14 @@ class AppData } /** - * Get AppData extension X-KDE-IRC + * Get Application irc channel * @return string[] */ public function getIrcChannels(): array { - if (isset($this->raw['X-KDE-IRC'])) { + if (isset($this->raw['Custom']) && isset($this->raw['Custom']['KDE::irc'])) { + return $this->raw['Custom']['KDE::irc']; + } else if (isset($this->raw['X-KDE-IRC'])) { $irc = $this->raw['X-KDE-IRC']; if (is_array($irc)) { return $irc; @@ -506,6 +510,18 @@ class AppData } } + /** + * Get Application matrix channel + * @return string[] + */ + public function getMatrixChannel(): ?string + { + if (isset($this->raw['Custom']) && isset($this->raw['Custom']['KDE::matrix'])) { + return $this->raw['Custom']['KDE::matrix']; + } + return null; + } + private function unifyMailingList(string $mailingList): string { if (endsWith($mailingList, '@kde.org')) { @@ -524,11 +540,14 @@ class AppData } /** - * AppData extension X-KDE-MailingLists + * AppData extension X-KDE-MailingLists or KDE::mailinglist * @return string[] */ public function getMailingLists(): array { + if (isset($this->raw['Custom']) && isset($this->raw['Custom']['KDE::mailinglist'])) { + return unifyMailingList($this->raw['Custom']['KDE::mailinglist']); + } $ml = []; if (isset($this->raw['X-KDE-MailingLists'])) { $ml = $this->raw['X-KDE-MailingLists']; @@ -542,6 +561,18 @@ class AppData return array_map('App\Model\AppData::unifyMailingList', $ml); } + /** + * AppData extension KDE::mailinglist-devel + * @return string[] + */ + public function getDevelMailingList(): ?string + { + if (isset($this->raw['Custom']) && isset($this->raw['Custom']['KDE::mailinglist-devel'])) { + return unifyMailingList($this->raw['Custom']['KDE::mailinglist-devel']); + } + return null; + } + /** * AppData extension X-KDE-Repository * @return string|null diff --git a/templates/main/application.html.twig b/templates/main/application.html.twig index a47d5b3..6033982 100644 --- a/templates/main/application.html.twig +++ b/templates/main/application.html.twig @@ -265,7 +265,13 @@ AppStream application stores. You can also use your distribution's package manag {% trans %}Report a bug{% endtrans %} - {% else %} + {% endif %} + {% if application.matrixChannel is not null %} + {% trans %}Matrix:{% endtrans %} + + {{ application.matrixChannel }} + +
{% endif %} {% if application.ircChannels | length > 0 %} {% trans %}IRC:{% endtrans %} @@ -283,6 +289,13 @@ AppStream application stores. You can also use your distribution's package manag {% endfor %} {% endif %} + {% if application.develMailingList is not null %} + {% trans %}Developer mailing list:{% endtrans %} + + {{ application.develMailingList }}@kde.org + +
+ {% endif %} {% if application.authors is not null %}
{% trans %}Author(s):{% endtrans %} -- GitLab