summaryrefslogtreecommitdiffstats
path: root/apps/updatenotification
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-07-05 00:41:59 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-07-05 14:33:08 +0200
commit772bbd99bee83d17707c73a630a4d47c4b8bc807 (patch)
tree9cc5293fe3454e3e71be018b80825a5686516ae5 /apps/updatenotification
parentcbfcfb236f3e8ace6c64ab5a654b9a331a3ce1c0 (diff)
downloadnextcloud-server-772bbd99bee83d17707c73a630a4d47c4b8bc807.tar.gz
nextcloud-server-772bbd99bee83d17707c73a630a4d47c4b8bc807.zip
Backend work to provide NC whats New info to users
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/updatenotification')
-rw-r--r--apps/updatenotification/lib/Settings/Admin.php33
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