diff options
author | Joas Schilling <coding@schilljs.com> | 2017-05-19 15:45:14 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-05-19 15:45:14 +0200 |
commit | edb4956290ae87afc97a24938647e347754dd951 (patch) | |
tree | 0f0a0f3e208284f298fd669ea7fa1568e5808bef /apps | |
parent | bcddca9a64fb980019df052a99bc08fbef14b577 (diff) | |
download | nextcloud-server-edb4956290ae87afc97a24938647e347754dd951.tar.gz nextcloud-server-edb4956290ae87afc97a24938647e347754dd951.zip |
Fix username and avatar for external users
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/lib/Activity/Provider.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php index 3efab382640..c3289ed3703 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -38,6 +38,8 @@ class Provider implements IProvider { /** @var IL10N */ protected $l; + /** @var IL10N */ + protected $activityLang; /** @var IURLGenerator */ protected $url; @@ -83,6 +85,7 @@ class Provider implements IProvider { } $this->l = $this->languageFactory->get('files', $language); + $this->activityLang = $this->languageFactory->get('activity', $language); if ($this->activityManager->isFormattingFilteredObject()) { try { @@ -126,6 +129,11 @@ class Provider implements IProvider { throw new \InvalidArgumentException(); } + if (!isset($parsedParameters['user'])) { + // External user via public link share + $subject = str_replace('{user}', $this->activityLang->t('"remote user"'), $subject); + } + $this->setSubjects($event, $subject, $parsedParameters); return $this->eventMerger->mergeEvents('user', $event, $previousEvent); @@ -182,6 +190,11 @@ class Provider implements IProvider { throw new \InvalidArgumentException(); } + if (!isset($parsedParameters['user'])) { + // External user via public link share + $subject = str_replace('{user}', $this->activityLang->t('"remote user"'), $subject); + } + $this->setSubjects($event, $subject, $parsedParameters); $event = $this->eventMerger->mergeEvents('file', $event, $previousEvent); @@ -229,6 +242,12 @@ class Provider implements IProvider { case 'changed_by': case 'deleted_by': case 'restored_by': + if ($parameters[1] === '') { + // External user via public link share + return [ + 'file' => $this->getFile($parameters[0], $event), + ]; + } return [ 'file' => $this->getFile($parameters[0], $event), 'user' => $this->getUser($parameters[1]), @@ -241,6 +260,13 @@ class Provider implements IProvider { ]; case 'renamed_by': case 'moved_by': + if ($parameters[1] === '') { + // External user via public link share + return [ + 'newfile' => $this->getFile($parameters[0]), + 'oldfile' => $this->getFile($parameters[2]), + ]; + } return [ 'newfile' => $this->getFile($parameters[0]), 'user' => $this->getUser($parameters[1]), |