diff --git a/apps/comments/appinfo/app.php b/apps/comments/appinfo/app.php index 00085cf914..df41bdfa32 100644 --- a/apps/comments/appinfo/app.php +++ b/apps/comments/appinfo/app.php @@ -32,6 +32,7 @@ $eventDispatcher->addListener( \OCP\Util::addScript('comments', 'commentsummarymodel'); \OCP\Util::addScript('comments', 'commentstabview'); \OCP\Util::addScript('comments', 'filesplugin'); + \OCP\Util::addScript('comments', 'activitytabviewplugin'); \OCP\Util::addStyle('comments', 'comments'); } ); diff --git a/apps/comments/css/comments.css b/apps/comments/css/comments.css index 7f64f1cf7d..103564c5fa 100644 --- a/apps/comments/css/comments.css +++ b/apps/comments/css/comments.css @@ -59,35 +59,39 @@ line-height: 32px; } +#activityTabView li.comment.collapsed .activitymessage, #commentsTabView .comment.collapsed .message { white-space: pre-wrap; } +#activityTabView li.comment.collapsed .activitymessage, #commentsTabView .comment.collapsed .message { max-height: 70px; overflow: hidden; } +#activityTabView li.comment .message-overlay, #commentsTabView .comment .message-overlay { display: none; } +#activityTabView li.comment.collapsed .message-overlay, #commentsTabView .comment.collapsed .message-overlay { display: block; - position: absolute; + position: absolute; z-index: 2; - height: 50px; - pointer-events: none; + height: 50px; + pointer-events: none; left: 0; right: 0; - bottom: 0; + bottom: 0; background: -moz-linear-gradient(rgba(255,255,255,0), rgba(255,255,255,1)); background: -webkit-linear-gradient(rgba(255,255,255,0), rgba(255,255,255,1)); background: -o-linear-gradient(rgba(255,255,255,0), rgba(255,255,255,1)); background: -ms-linear-gradient(rgba(255,255,255,0), rgba(255,255,255,1)); background: linear-gradient(rgba(255,255,255,0), rgba(255,255,255,1)); filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00FFFFFF', endColorstr='#FFFFFFFF'); - background-repeat: no-repeat; + background-repeat: no-repeat; } #commentsTabView .authorRow>div { diff --git a/apps/comments/js/activitytabviewplugin.js b/apps/comments/js/activitytabviewplugin.js new file mode 100644 index 0000000000..ca3253bd13 Binary files /dev/null and b/apps/comments/js/activitytabviewplugin.js differ diff --git a/apps/comments/lib/Activity/Extension.php b/apps/comments/lib/Activity/Extension.php index 8abe42eb9d..6bf7bc9ac0 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('/^\(\d*)\<\/parameter\>$/', $parameter, $matches)) { try { $comment = $this->commentsManager->get((int) $matches[1]); $message = $comment->getMessage(); $message = str_replace("\n", '
', 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 '';