зеркало из https://github.com/nextcloud/spreed.git
Add size to system message from shared file
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
Родитель
7083bbc04f
Коммит
805b1cfc93
|
@ -323,6 +323,7 @@ class SystemMessage {
|
||||||
$share = $this->shareProvider->getShareById($shareId);
|
$share = $this->shareProvider->getShareById($shareId);
|
||||||
$node = $share->getNode();
|
$node = $share->getNode();
|
||||||
$name = $node->getName();
|
$name = $node->getName();
|
||||||
|
$size = $node->getSize();
|
||||||
$path = $name;
|
$path = $name;
|
||||||
|
|
||||||
if (!$participant->isGuest()) {
|
if (!$participant->isGuest()) {
|
||||||
|
@ -349,6 +350,7 @@ class SystemMessage {
|
||||||
$fullPath = $userNode->getPath();
|
$fullPath = $userNode->getPath();
|
||||||
$pathSegments = explode('/', $fullPath, 4);
|
$pathSegments = explode('/', $fullPath, 4);
|
||||||
$name = $userNode->getName();
|
$name = $userNode->getName();
|
||||||
|
$size = $userNode->getSize();
|
||||||
$path = $pathSegments[3] ?? $path;
|
$path = $pathSegments[3] ?? $path;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -370,6 +372,7 @@ class SystemMessage {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => (string) $node->getId(),
|
'id' => (string) $node->getId(),
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
|
'size' => $size,
|
||||||
'path' => $path,
|
'path' => $path,
|
||||||
'link' => $url,
|
'link' => $url,
|
||||||
'mimetype' => $node->getMimeType(),
|
'mimetype' => $node->getMimeType(),
|
||||||
|
|
|
@ -433,6 +433,9 @@ class SystemMessageTest extends TestCase {
|
||||||
$node->expects($this->once())
|
$node->expects($this->once())
|
||||||
->method('getMimeType')
|
->method('getMimeType')
|
||||||
->willReturn('text/plain');
|
->willReturn('text/plain');
|
||||||
|
$node->expects($this->once())
|
||||||
|
->method('getSize')
|
||||||
|
->willReturn(65530);
|
||||||
|
|
||||||
$share = $this->createMock(IShare::class);
|
$share = $this->createMock(IShare::class);
|
||||||
$share->expects($this->once())
|
$share->expects($this->once())
|
||||||
|
@ -469,6 +472,7 @@ class SystemMessageTest extends TestCase {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => '54',
|
'id' => '54',
|
||||||
'name' => 'name',
|
'name' => 'name',
|
||||||
|
'size' => 65530,
|
||||||
'path' => 'name',
|
'path' => 'name',
|
||||||
'link' => 'absolute-link',
|
'link' => 'absolute-link',
|
||||||
'mimetype' => 'text/plain',
|
'mimetype' => 'text/plain',
|
||||||
|
@ -490,6 +494,9 @@ class SystemMessageTest extends TestCase {
|
||||||
$node->expects($this->once())
|
$node->expects($this->once())
|
||||||
->method('getMimeType')
|
->method('getMimeType')
|
||||||
->willReturn('httpd/unix-directory');
|
->willReturn('httpd/unix-directory');
|
||||||
|
$node->expects($this->once())
|
||||||
|
->method('getSize')
|
||||||
|
->willReturn(65520);
|
||||||
|
|
||||||
$share = $this->createMock(IShare::class);
|
$share = $this->createMock(IShare::class);
|
||||||
$share->expects($this->once())
|
$share->expects($this->once())
|
||||||
|
@ -529,6 +536,7 @@ class SystemMessageTest extends TestCase {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => '54',
|
'id' => '54',
|
||||||
'name' => 'name',
|
'name' => 'name',
|
||||||
|
'size' => 65520,
|
||||||
'path' => 'path/to/file/name',
|
'path' => 'path/to/file/name',
|
||||||
'link' => 'absolute-link-owner',
|
'link' => 'absolute-link-owner',
|
||||||
'mimetype' => 'httpd/unix-directory',
|
'mimetype' => 'httpd/unix-directory',
|
||||||
|
@ -547,6 +555,9 @@ class SystemMessageTest extends TestCase {
|
||||||
$node->expects($this->once())
|
$node->expects($this->once())
|
||||||
->method('getMimeType')
|
->method('getMimeType')
|
||||||
->willReturn('application/octet-stream');
|
->willReturn('application/octet-stream');
|
||||||
|
$node->expects($this->once())
|
||||||
|
->method('getSize')
|
||||||
|
->willReturn(65510);
|
||||||
|
|
||||||
$share = $this->createMock(IShare::class);
|
$share = $this->createMock(IShare::class);
|
||||||
$share->expects($this->once())
|
$share->expects($this->once())
|
||||||
|
@ -573,6 +584,9 @@ class SystemMessageTest extends TestCase {
|
||||||
$file->expects($this->once())
|
$file->expects($this->once())
|
||||||
->method('getPath')
|
->method('getPath')
|
||||||
->willReturn('/user/files/Shared/different');
|
->willReturn('/user/files/Shared/different');
|
||||||
|
$file->expects($this->once())
|
||||||
|
->method('getSize')
|
||||||
|
->willReturn(65515);
|
||||||
|
|
||||||
$userFolder = $this->createMock(Folder::class);
|
$userFolder = $this->createMock(Folder::class);
|
||||||
$userFolder->expects($this->once())
|
$userFolder->expects($this->once())
|
||||||
|
@ -602,6 +616,7 @@ class SystemMessageTest extends TestCase {
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'id' => '54',
|
'id' => '54',
|
||||||
'name' => 'different',
|
'name' => 'different',
|
||||||
|
'size' => 65515,
|
||||||
'path' => 'Shared/different',
|
'path' => 'Shared/different',
|
||||||
'link' => 'absolute-link-owner',
|
'link' => 'absolute-link-owner',
|
||||||
'mimetype' => 'application/octet-stream',
|
'mimetype' => 'application/octet-stream',
|
||||||
|
|
Загрузка…
Ссылка в новой задаче