Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
cf22d23b
Commit
cf22d23b
authored
Sep 08, 2012
by
dawehner
Committed by
tim.plunkett
Oct 21, 2012
Browse files
Issue
#1777512
by dawehner: Fixed UidRevision filter handler uses undefined variable.
parent
206cd481
Changes
5
Hide whitespace changes
Inline
Side-by-side
includes/ajax.inc
View file @
cf22d23b
...
...
@@ -5,6 +5,8 @@
* Handles the server side AJAX interactions of Views.
*/
use
Symfony\Component\HttpFoundation\JsonResponse
;
/**
* @defgroup ajax Views AJAX library
* @{
...
...
lib/Drupal/views/Tests/Node/FilterUidRevisionTest.php
0 → 100644
View file @
cf22d23b
<?php
/**
* @file
* Definition of Drupal\views\Tests\Comment\FilterUidRevisionTest.
*/
namespace
Drupal\views\Tests\Node
;
/**
* Tests the node_uid_revision handler.
*/
class
FilterUidRevisionTest
extends
NodeTestBase
{
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'Node: User has revision Filter'
,
'description'
=>
'Tests the node_uid_revision handler.'
,
'group'
=>
'Views Modules'
,
);
}
/**
* Tests the node_uid_revision filter.
*/
public
function
testFilter
()
{
$author
=
$this
->
drupalCreateUser
();
$no_author
=
$this
->
drupalCreateUser
();
$expected_result
=
array
();
// Create one node, with the author as the node author.
$node
=
$this
->
drupalCreateNode
(
array
(
'uid'
=>
$author
->
id
()));
$expected_result
[]
=
array
(
'nid'
=>
$node
->
id
());
// Create one node of which an additional revision author will be the
// author.
$node
=
$this
->
drupalCreateNode
(
array
(
'uid'
=>
$no_author
->
id
()));
$expected_result
[]
=
array
(
'nid'
=>
$node
->
id
());
$revision
=
clone
$node
;
// Force to add a new revision.
$revision
->
set
(
'vid'
,
NULL
);
$revision
->
set
(
'revision_uid'
,
$author
->
id
());
$revision
->
save
();
// Create one node on which the author has neither authorship of revisions
// or the main node.
$node
=
$this
->
drupalCreateNode
(
array
(
'uid'
=>
$no_author
->
id
()));
$view
=
views_get_view
(
'test_filter_node_uid_revision'
);
$view
->
initDisplay
();
$view
->
initHandlers
();
$view
->
filter
[
'uid_revision'
]
->
value
=
array
(
$author
->
uid
);
$this
->
executeView
(
$view
);
$this
->
assertIdenticalResultset
(
$view
,
$expected_result
,
array
(
'nid'
=>
'nid'
),
'Make sure that the view only returns nodes which match either the node or the revision author.'
);
}
}
lib/Drupal/views/Tests/Node/NodeTestBase.php
0 → 100644
View file @
cf22d23b
<?php
/**
* @file
* Definition of Drupal\views\Tests\Node\NodeTestBase.
*/
namespace
Drupal\views\Tests\Node
;
use
Drupal\views\Tests\ViewTestBase
;
/**
* Base class for all node tests.
*/
abstract
class
NodeTestBase
extends
ViewTestBase
{
}
lib/Views/node/Plugin/views/filter/UidRevision.php
View file @
cf22d23b
...
...
@@ -29,7 +29,7 @@ public function query($group_by = FALSE) {
$args
=
array_values
(
$this
->
value
);
$this
->
query
->
add_where_expression
(
$this
->
options
[
'group'
],
"
$this->table_alias
.uid IN(
$placeholder
)
"
.
$condition
.
"
OR
$this
->
query
->
add_where_expression
(
$this
->
options
[
'group'
],
"
$this->table_alias
.uid IN(
$placeholder
) OR
((SELECT COUNT(*) FROM
{
node_revision
}
nr WHERE nr.uid IN(
$placeholder
) AND nr.nid =
$this->table_alias
.nid) > 0)"
,
array
(
$placeholder
=>
$args
),
$args
);
}
...
...
tests/views_test_config/config/views.view.test_filter_node_uid_revision.yml
0 → 100644
View file @
cf22d23b
api_version
:
'
3.0'
base_table
:
node
core
:
8.0-dev
description
:
'
'
disabled
:
'
0'
display
:
default
:
display_options
:
access
:
type
:
perm
cache
:
type
:
none
exposed_form
:
type
:
basic
fields
:
nid
:
id
:
nid
table
:
node
field
:
nid
filter_groups
:
groups
:
1
:
AND
operator
:
AND
filters
:
uid_revision
:
admin_label
:
'
'
field
:
uid_revision
id
:
uid_revision
is_grouped
:
'
0'
operator
:
in
relationship
:
none
table
:
node
value
:
-
'
1'
sorts
:
nid
:
id
:
nid
table
:
node
field
:
nid
order
:
asc
pager
:
type
:
full
query
:
type
:
views_query
row_plugin
:
fields
sorts
:
{
}
style_plugin
:
default
display_plugin
:
default
display_title
:
Master
id
:
default
position
:
'
0'
human_name
:
test_filter_node_uid_revision
name
:
test_filter_node_uid_revision
tag
:
default
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