diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2017-05-23 08:33:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-23 08:33:49 +0200 |
commit | 3aee260737bc28c6cb792a435f37883f3f2f1d83 (patch) | |
tree | 1da8e0e69d36df915edc158a5cc2b70bd9a431db | |
parent | 9c8a8386240d440e8f7363d85dd3ead2207b7a60 (diff) | |
parent | edb4956290ae87afc97a24938647e347754dd951 (diff) | |
download | nextcloud-server-3aee260737bc28c6cb792a435f37883f3f2f1d83.tar.gz nextcloud-server-3aee260737bc28c6cb792a435f37883f3f2f1d83.zip |
Merge pull request #4969 from nextcloud/fix-broken-activity-avatars-with-external-users
Fix username and avatar for external users
-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]), |