diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-07-13 17:25:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-13 17:25:51 +0200 |
commit | 14314584ba88ed8d8a7c8486b61c6677a14271f2 (patch) | |
tree | a24439cf1b1c243318532322d52d89fe4530fc47 /apps/updatenotification | |
parent | 1801e4e03f3a0b5ef253d67c13702b0fa22578a3 (diff) | |
parent | ca6094f3900fd463449d9973589b1d49aed28b2a (diff) | |
download | nextcloud-server-14314584ba88ed8d8a7c8486b61c6677a14271f2.tar.gz nextcloud-server-14314584ba88ed8d8a7c8486b61c6677a14271f2.zip |
Merge pull request #10110 from nextcloud/feature/100500/whats-new-info-users
Display What's New info to users
Diffstat (limited to 'apps/updatenotification')
-rw-r--r-- | apps/updatenotification/lib/Settings/Admin.php | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/apps/updatenotification/lib/Settings/Admin.php b/apps/updatenotification/lib/Settings/Admin.php index b859ca79f62..cae62ee0a9f 100644 --- a/apps/updatenotification/lib/Settings/Admin.php +++ b/apps/updatenotification/lib/Settings/Admin.php @@ -123,39 +123,18 @@ class Admin implements ISettings { return $filtered; } - $isFirstCall = true; + $iterator = $this->l10nFactory->getLanguageIterator(); do { - $lang = $this->l10nFactory->iterateLanguage($isFirstCall); - if($this->findWhatsNewTranslation($lang, $filtered, $changes['whatsNew'])) { - return $filtered; + $lang = $iterator->current(); + if(isset($changes['whatsNew'][$lang])) { + return $filtered['whatsNew'][$lang]; } - $isFirstCall = false; - } while($lang !== 'en'); + $iterator->next(); + } while($lang !== 'en' && $iterator->valid()); return $filtered; } - protected function getLangTrunk(string $lang):string { - $pos = strpos($lang, '_'); - if($pos !== false) { - $lang = substr($lang, 0, $pos); - } - return $lang; - } - - protected function findWhatsNewTranslation(string $lang, array &$result, array $whatsNew): bool { - if(isset($whatsNew[$lang])) { - $result['whatsNew'] = $whatsNew[$lang]; - return true; - } - $trunkedLang = $this->getLangTrunk($lang); - if($trunkedLang !== $lang && isset($whatsNew[$trunkedLang])) { - $result['whatsNew'] = $whatsNew[$trunkedLang]; - return true; - } - return false; - } - /** * @param array $groupIds * @return array |