diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-10-05 23:56:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-05 23:56:10 +0200 |
commit | fe2116ecf73e707aa30130b767fd6b0b7bf17787 (patch) | |
tree | f6a3591be447f6bb191ec79ee4c31b0350035573 /apps/comments/lib/Activity | |
parent | 8dafcab691dbab1517bb4ec77fb574b2922c625e (diff) | |
parent | 43265befac637d09c71e4f639c317e423e3bbfd6 (diff) | |
download | nextcloud-server-fe2116ecf73e707aa30130b767fd6b0b7bf17787.tar.gz nextcloud-server-fe2116ecf73e707aa30130b767fd6b0b7bf17787.zip |
Merge pull request #1519 from nextcloud/better-comments-in-activity-sidebar
Better comments in activity sidebar
Diffstat (limited to 'apps/comments/lib/Activity')
-rw-r--r-- | apps/comments/lib/Activity/Extension.php | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/apps/comments/lib/Activity/Extension.php b/apps/comments/lib/Activity/Extension.php index 8abe42eb9df..6bf7bc9ac0b 100644 --- a/apps/comments/lib/Activity/Extension.php +++ b/apps/comments/lib/Activity/Extension.php @@ -159,7 +159,7 @@ class Extension implements IExtension { } return (string) $l->t('%1$s commented', $params); case self::ADD_COMMENT_MESSAGE: - return $this->convertParameterToComment($params[0], 120); + return $this->convertParameterToComment($params[0]); } return false; @@ -196,7 +196,6 @@ class Extension implements IExtension { try { return strip_tags($user) === $this->activityManager->getCurrentUserId(); } catch (\UnexpectedValueException $e) { - // FIXME this is awkward, but we have no access to the current user in emails return false; } } @@ -301,21 +300,12 @@ class Extension implements IExtension { * @param string $parameter * @return string */ - protected function convertParameterToComment($parameter, $maxLength = 0) { + protected function convertParameterToComment($parameter) { if (preg_match('/^\<parameter\>(\d*)\<\/parameter\>$/', $parameter, $matches)) { try { $comment = $this->commentsManager->get((int) $matches[1]); $message = $comment->getMessage(); $message = str_replace("\n", '<br />', str_replace(['<', '>'], ['<', '>'], $message)); - - if ($maxLength && isset($message[$maxLength + 20])) { - $findSpace = strpos($message, ' ', $maxLength); - if ($findSpace !== false && $findSpace < $maxLength + 20) { - return substr($message, 0, $findSpace) . '…'; - } - return substr($message, 0, $maxLength + 20) . '…'; - } - return $message; } catch (NotFoundException $e) { return ''; |