Merge pull request #3477 from nextcloud/fix-cloud-id-manager-injection

Fix DI of the cloud id manager into apps
This commit is contained in:
Morris Jobke 2017-02-14 17:42:53 -06:00 committed by GitHub
commit b5b541d084
3 changed files with 7 additions and 1 deletions

View File

@ -25,7 +25,6 @@ namespace OCA\FederatedFileSharing;
use OC\HintException; use OC\HintException;
use OC\Share\Helper;
use OCP\Contacts\IManager; use OCP\Contacts\IManager;
use OCP\Federation\ICloudId; use OCP\Federation\ICloudId;
use OCP\Federation\ICloudIdManager; use OCP\Federation\ICloudIdManager;
@ -63,6 +62,7 @@ class Notifier implements INotifier {
* @param INotification $notification * @param INotification $notification
* @param string $languageCode The code of the language that should be used to prepare the notification * @param string $languageCode The code of the language that should be used to prepare the notification
* @return INotification * @return INotification
* @throws \InvalidArgumentException
*/ */
public function prepare(INotification $notification, $languageCode) { public function prepare(INotification $notification, $languageCode) {
if ($notification->getApp() !== 'files_sharing') { if ($notification->getApp() !== 'files_sharing') {

View File

@ -49,6 +49,7 @@ use OC\RichObjectStrings\Validator;
use OC\Security\Bruteforce\Throttler; use OC\Security\Bruteforce\Throttler;
use OCP\AppFramework\IApi; use OCP\AppFramework\IApi;
use OCP\AppFramework\IAppContainer; use OCP\AppFramework\IAppContainer;
use OCP\Federation\ICloudIdManager;
use OCP\Files\IAppData; use OCP\Files\IAppData;
use OCP\Files\Mount\IMountManager; use OCP\Files\Mount\IMountManager;
use OCP\RichObjectStrings\IValidator; use OCP\RichObjectStrings\IValidator;
@ -152,6 +153,10 @@ class DIContainer extends SimpleContainer implements IAppContainer {
return $this->getServer()->getQueryLogger(); return $this->getServer()->getQueryLogger();
}); });
$this->registerService(ICloudIdManager::class, function($c) {
return $this->getServer()->getCloudIdManager();
});
$this->registerService('OCP\\Files\\IMimeTypeDetector', function($c) { $this->registerService('OCP\\Files\\IMimeTypeDetector', function($c) {
return $this->getServer()->getMimeTypeDetector(); return $this->getServer()->getMimeTypeDetector();
}); });

View File

@ -27,6 +27,7 @@ class CloudIdManager implements ICloudIdManager {
/** /**
* @param string $cloudId * @param string $cloudId
* @return ICloudId * @return ICloudId
* @throws \InvalidArgumentException
*/ */
public function resolveCloudId($cloudId) { public function resolveCloudId($cloudId) {
// TODO magic here to get the url and user instead of just splitting on @ // TODO magic here to get the url and user instead of just splitting on @