Hello,

I just upgrated views from version 3.3 to 3.5. I had created a view that lists up the node revisions in a table with some information. After the upgrate the view stopped working correctly.

I tried to create a new view that does the same trick but that view would only display the latest revision of each node for me.

I hope this will get fixed in the next revision :-)

Best regards,
Bjarki

Files: 
CommentFileSizeAuthor
#16 views-1754354-16.patch2.19 KBdawehner
FAILED: [[SimpleTest]]: [MySQL] 2,113 pass(es), 3 fail(s), and 6 exception(s).
[ View ]
#14 views-1754354-14.patch6.48 KBdawehner
PASSED: [[SimpleTest]]: [MySQL] 2,081 pass(es).
[ View ]
#8 1754354-views-node-revision-nid.8.patch11.69 KBandypost
PASSED: [[SimpleTest]]: [MySQL] 1,603 pass(es).
[ View ]
#7 1754354-views-node-revision-nid.7.patch2.42 KBandypost
PASSED: [[SimpleTest]]: [MySQL] 1,598 pass(es).
[ View ]
#6 1754354-views-node-revision-nid.6.patch2.19 KBandypost
PASSED: [[SimpleTest]]: [MySQL] 1,598 pass(es).
[ View ]
#4 fixed_revisions_relationship-1754354-4.patch1.93 KBPatchRanger
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]

Comments

dawehner’s picture

Status:Needs work» Postponed (maintainer needs more info)

Could you please post an export of your view? You know we would like to understand what you did.

manuelBS’s picture

The same for me. I just updated. The view told me that there where some relations added and I have to check if everything is ok but it isn't. My view is only showing the latest revision, but not a list of all revisions. Before the update it worked.

$view = new view();
$view->name = 'node_revisions';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node_revision';
$view->human_name = 'Node revisions';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Revisions';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'view revisions';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '15';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'timestamp' => 'timestamp',
  'title' => 'title',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'timestamp' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'title' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
);
/* Relationship: Content revision: User */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'node_revision';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
/* Relationship: Content revision: Content */
$handler->display->display_options['relationships']['vid']['id'] = 'vid';
$handler->display->display_options['relationships']['vid']['table'] = 'node_revision';
$handler->display->display_options['relationships']['vid']['field'] = 'vid';
/* Field: Content revision: Updated date */
$handler->display->display_options['fields']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['table'] = 'node_revision';
$handler->display->display_options['fields']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['timestamp']['alter']['ellipsis'] = FALSE;
/* Field: Content revision: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node_revision';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['title']['link_to_node_revision'] = TRUE;
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['relationship'] = 'uid';
$handler->display->display_options['fields']['name']['label'] = 'User';
/* Sort criterion: Content revision: Updated date */
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['table'] = 'node_revision';
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
/* Contextual filter: Content: Nid */
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['relationship'] = 'vid';
$handler->display->display_options['arguments']['nid']['default_action'] = 'not found';
$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['relationship'] = 'vid';
$handler->display->display_options['filters']['status']['value'] = '1';
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;

/* Display: Pane node revisions */
$handler = $view->new_display('panel_pane', 'Pane node revisions', 'panel_pane_1');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['argument_input'] = array(
  'nid' => array(
    'type' => 'panel',
    'context' => 'entity:billable.billable-id',
    'context_optional' => 0,
    'panel' => '0',
    'fixed' => '',
    'label' => 'Content: Nid',
  ),
);

esmerel’s picture

Status:Postponed (maintainer needs more info)» Active
PatchRanger’s picture

Version:7.x-3.5» 7.x-3.x-dev
Status:Active» Needs review
StatusFileSize
new1.93 KB
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]

Indeed.
As you could see it becomes broken after this commit : http://drupalcode.org/project/views.git/commit/e2a1e453441e3969b8235398e... , where mistakenly was changed base field of relationship.
Here you are a patch that fixes this bug and prevents others.

andypost’s picture

@Staratel Take a look at patch #1321288-7: How to: make views get and display ALL revisions of a given content (now: views only gets the latest revision)
Supposse much better to describe a node_revision.NID field for views.
After #1547726: Kill implicit relationship from node to node_revision this ability was lost

andypost’s picture

StatusFileSize
new2.19 KB
PASSED: [[SimpleTest]]: [MySQL] 1,598 pass(es).
[ View ]

Marked as duplicate #1321288-7: How to: make views get and display ALL revisions of a given content (now: views only gets the latest revision)

This patch introduces node_revision.NID field for Views-data

andypost’s picture

StatusFileSize
new2.42 KB
PASSED: [[SimpleTest]]: [MySQL] 1,598 pass(es).
[ View ]

Patch introduces 2 different relations:
1) default on NID as it was before regression
2) on VID to query only active revisions

andypost’s picture

StatusFileSize
new11.69 KB
PASSED: [[SimpleTest]]: [MySQL] 1,603 pass(es).
[ View ]

Same patch with test

andypost’s picture

Priority:Normal» Critical

This really critical because changed behavior could break views used in rules and cause a data loss

B-Prod’s picture

Status:Needs review» Reviewed & tested by the community

I applied the patch on the current release (not DEV version) and it fixes the issue as expected.

dawehner’s picture

Version:7.x-3.x-dev» 8.x-3.x-dev
Priority:Critical» Major
Status:Reviewed & tested by the community» Patch (to be ported)

* Removed the debug messages out of the test and committed to 7.x-3.x

This needs for sure a port towards d8.

tanmayk’s picture

I have applied the patch in #4, worked for me :-)
But getting debug on view page.

Debug:

'Handler views_handler_field_node_revision tried to add additional_field nid but node could not be added!'

in views_handler_field->add_additional_fields() (line 142 of /svn/sharp_crm/trunk/www/sites/all/modules/contrib/views/handlers/views_handler_field.inc).

dawehner’s picture

Assign the port to myself as i require this views data in another test :)

dawehner’s picture

Status:Patch (to be ported)» Needs review
StatusFileSize
new6.48 KB
PASSED: [[SimpleTest]]: [MySQL] 2,081 pass(es).
[ View ]

Here is a port of the patch and the test.

aspilicious’s picture

can we have test only? please? :p

dawehner’s picture

StatusFileSize
new2.19 KB
FAILED: [[SimpleTest]]: [MySQL] 2,113 pass(es), 3 fail(s), and 6 exception(s).
[ View ]

Let's break it

Status:Needs review» Needs work

The last submitted patch, views-1754354-16.patch, failed testing.

dawehner’s picture

Status:Needs work» Needs review

Back to needs review.

aspilicious’s picture

Status:Needs review» Reviewed & tested by the community

Looks good :)

dawehner’s picture

Status:Reviewed & tested by the community» Fixed

Thank you for the review and the patch for 7.x-3.x

Committed and pushed.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

partdigital’s picture

I applied the patch from #7 on views 3.5 and I still could only see the latest revisions. None of the others.

a.milkovsky’s picture

#4 works for me, thanks!
I applied the patch from #4 on views 3.5 and flushed all caches

pianomansam’s picture

Any chance we can get a new version of 7.x rolled that includes this patch?

johnv’s picture

I checked views 3.6, and the patch is included in that version.

brandy.brown’s picture

#4 worked for me. Although now it's display a ton of the same revision, but that's probably some other issue.

leex’s picture

Issue summary:View changes

I still have this issue in views 3.7 where just 1 revision is returned.

Tschet’s picture

I'm also using 3.7 and seeing only the newest revisions.

Bojhan’s picture

Status:Closed (fixed)» Active

I am also only getting the latest revision. I've pasted my view below it seems like the NID is being picked up but only for the first revision.

Bojhan’s picture

Dawhener found several bugs, this seems to resolve it for me (in my D7 install I fixed it too):

#2229167: Broken/missing handler (Module: node) …
#2229173: node_revision.status should|title be node_field_revision.status|title

rooby’s picture

I'm also only getting one result per node on a content revisions view using 3.7

granticusiv’s picture

I don't know if this will help your particular case rooby, but I found I had to remove the "(Get the actual content from a content revision.) Content: Published (Yes)" filter that's included by default with a new Content Revisions view.

If adding a contextual filter, I had to use "Content revision: Nid", not "Content: Nid".

Using Views 3.7

murilowadt’s picture

In my case, I needed to use all "Content Revision:" fields instead of "Content:". For instance Content Revision: Title instead of Content: Title.
Hope this helps. Did not used contextual filters and it's working with 3.7 and 3.8 Views Module.

pinkonomy’s picture

I am using Views 3.7 and my view shows only the latest revision.Anyone help on this?

murilowadt’s picture

#33 worked to me. Just removed the default filter "(Get the actual content from a content revision.) Content: Published (Yes)" and it started to show all revisions.

paulmckibben’s picture

I am seeing this in Views 3.10. It shows only the latest revision if I add a filter on content type, i.e. "(Get the actual content from a content revision.) Content: Type (= [Type Name])."

Expected behavior: it should be possible to filter content revisions on properties and fields.

paulmckibben’s picture

Found a fix: there were two different relationships available with the same human-readable name, "Get the actual content from a content revision." The default relationship used the revision ID (vid) for joining the node and node_revision tables. This excluded all revisions other than the most recent. I deleted that relationship and used the one that uses the content ID (nid) for joining the node and node_revision tables, and that relationship did the trick.

joekers’s picture

@paulmckibben Was this on a 'content_revision' view or a normal 'content' view? I'm using a normal content view and I'm trying to show the latest revision of content (drafts), however I can only show the current revision.

I've tried adding the relationship using the revision ID (vid) and it shows multiple revisions of the same node but the content of all of the fields are the current revision instead of the latest revision.