Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-11-22 18:39:29 +0300
committerJoas Schilling <coding@schilljs.com>2016-11-22 18:39:29 +0300
commite1feb725837477e66ac3e5920837637de401f7b8 (patch)
treec3d8820dc8a88acee24e7736f6cde8996ffe56d9 /apps/systemtags/lib
parentb5fab4ed9cc23b0408057f9e8b0cb90b2e50fa73 (diff)
Use the display name for files activities again
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/systemtags/lib')
-rw-r--r--apps/systemtags/lib/Activity/Provider.php35
1 files changed, 31 insertions, 4 deletions
diff --git a/apps/systemtags/lib/Activity/Provider.php b/apps/systemtags/lib/Activity/Provider.php
index 9d85300d5be..37ede8c3b8f 100644
--- a/apps/systemtags/lib/Activity/Provider.php
+++ b/apps/systemtags/lib/Activity/Provider.php
@@ -26,6 +26,8 @@ use OCP\Activity\IManager;
use OCP\Activity\IProvider;
use OCP\IL10N;
use OCP\IURLGenerator;
+use OCP\IUser;
+use OCP\IUserManager;
class Provider implements IProvider {
@@ -45,15 +47,23 @@ class Provider implements IProvider {
/** @var IManager */
protected $activityManager;
+ /** @var IUserManager */
+ protected $userManager;
+
+ /** @var string[] */
+ protected $displayNames = [];
+
/**
* @param IL10N $l
* @param IURLGenerator $url
* @param IManager $activityManager
+ * @param IUserManager $userManager
*/
- public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager) {
+ public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) {
$this->l = $l;
$this->url = $url;
$this->activityManager = $activityManager;
+ $this->userManager = $userManager;
}
/**
@@ -278,11 +288,15 @@ class Provider implements IProvider {
];
}
- protected function getUserParameter($parameter) {
+ protected function getUserParameter($uid) {
+ if (!isset($this->displayNames[$uid])) {
+ $this->displayNames[$uid] = $this->getDisplayName($uid);
+ }
+
return [
'type' => 'user',
- 'id' => $parameter,
- 'name' => $parameter,// FIXME Use display name
+ 'id' => $uid,
+ 'name' => $this->displayNames[$uid],
];
}
@@ -295,4 +309,17 @@ class Provider implements IProvider {
return $this->l->t('%s (invisible)', $parameter['name']);
}
}
+
+ /**
+ * @param string $uid
+ * @return string
+ */
+ protected function getDisplayName($uid) {
+ $user = $this->userManager->get($uid);
+ if ($user instanceof IUser) {
+ return $user->getDisplayName();
+ } else {
+ return $uid;
+ }
+ }
}