Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
ae4aa413
Commit
ae4aa413
authored
Mar 29, 2017
by
Piotr M
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem with 0 comments
parent
62f6d25a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php
apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php
+2
-0
apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
...sts/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
+29
-0
No files found.
apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php
View file @
ae4aa413
...
@@ -179,6 +179,8 @@ class CommentPropertiesPlugin extends ServerPlugin {
...
@@ -179,6 +179,8 @@ class CommentPropertiesPlugin extends ServerPlugin {
[
$node
->
getId
()],
[
$node
->
getId
()],
$user
);
$user
);
// Initialize with 0 as in prefetch phase in handleGetProperties
$numberOfCommentsForNode
=
0
;
if
(
isset
(
$numberOfCommentsForNodes
[
$node
->
getId
()]))
{
if
(
isset
(
$numberOfCommentsForNodes
[
$node
->
getId
()]))
{
$numberOfCommentsForNode
=
$numberOfCommentsForNodes
[
$node
->
getId
()];
$numberOfCommentsForNode
=
$numberOfCommentsForNodes
[
$node
->
getId
()];
}
}
...
...
apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
View file @
ae4aa413
...
@@ -304,4 +304,33 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
...
@@ -304,4 +304,33 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
}
}
}
}
/**
* @dataProvider userProvider
* @param $user
*/
public
function
testGetUnreadCountWithZeroUnread
(
$user
)
{
$node
=
$this
->
getMockBuilder
(
'\OCA\DAV\Connector\Sabre\File'
)
->
disableOriginalConstructor
()
->
getMock
();
$node
->
expects
(
$this
->
any
())
->
method
(
'getId'
)
->
will
(
$this
->
returnValue
(
'4567'
));
$this
->
userSession
->
expects
(
$this
->
once
())
->
method
(
'getUser'
)
->
will
(
$this
->
returnValue
(
$user
));
$numberOfCommentsForNodes
=
[];
$this
->
commentsManager
->
expects
(
$this
->
any
())
->
method
(
'getNumberOfUnreadCommentsForNodes'
)
->
willReturn
(
$numberOfCommentsForNodes
);
$unread
=
$this
->
plugin
->
getUnreadCount
(
$node
);
if
(
is_null
(
$user
))
{
$this
->
assertNull
(
$unread
);
}
else
{
$this
->
assertSame
(
$unread
,
0
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment