diff options
Diffstat (limited to 'app/Core')
-rw-r--r-- | app/Core/Base.php | 3 | ||||
-rw-r--r-- | app/Core/Markdown.php | 21 |
2 files changed, 15 insertions, 9 deletions
diff --git a/app/Core/Base.php b/app/Core/Base.php index e7ccafaa..881cccbd 100644 --- a/app/Core/Base.php +++ b/app/Core/Base.php @@ -58,7 +58,8 @@ use Pimple\Container; * @property \Kanboard\Core\Paginator $paginator * @property \Kanboard\Core\Template $template * @property \Kanboard\Decorator\MetadataCacheDecorator $userMetadataCacheDecorator - * @property \Kanboard\Decorator\columnRestrictionCacheDecorator $columnRestrictionCacheDecorator + * @property \Kanboard\Decorator\UserCacheDecorator $userCacheDecorator + * @property \Kanboard\Decorator\ColumnRestrictionCacheDecorator $columnRestrictionCacheDecorator * @property \Kanboard\Decorator\ColumnMoveRestrictionCacheDecorator $columnMoveRestrictionCacheDecorator * @property \Kanboard\Decorator\ProjectRoleRestrictionCacheDecorator $projectRoleRestrictionCacheDecorator * @property \Kanboard\Model\ActionModel $actionModel diff --git a/app/Core/Markdown.php b/app/Core/Markdown.php index 799aefb4..4487bf2a 100644 --- a/app/Core/Markdown.php +++ b/app/Core/Markdown.php @@ -86,18 +86,23 @@ class Markdown extends Parsedown */ protected function inlineUserLink(array $Excerpt) { - if (! $this->isPublicLink && preg_match('/^@([^\s,!.:?]+)/', $Excerpt['text'], $matches)) { - $user_id = $this->container['userModel']->getIdByUsername($matches[1]); + if (! $this->isPublicLink && preg_match('/^@([^\s,!:?]+)/', $Excerpt['text'], $matches)) { + $username = rtrim($matches[1], '.'); + $user = $this->container['userCacheDecorator']->getByUsername($username); - if (! empty($user_id)) { - $url = $this->container['helper']->url->href('UserViewController', 'profile', array('user_id' => $user_id)); + if (! empty($user)) { + $url = $this->container['helper']->url->href('UserViewController', 'profile', array('user_id' => $user['id'])); return array( - 'extent' => strlen($matches[0]), + 'extent' => strlen($username) + 1, 'element' => array( - 'name' => 'a', - 'text' => $matches[0], - 'attributes' => array('href' => $url, 'class' => 'user-mention-link'), + 'name' => 'a', + 'text' => '@' . $username, + 'attributes' => array( + 'href' => $url, + 'class' => 'user-mention-link', + 'title' => $user['name'] ?: $user['username'], + ), ), ); } |