Needs work
Project:
Workbench Moderation
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
1 Dec 2015 at 01:26 UTC
Updated:
25 Jan 2023 at 03:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kim.pepperCreated a basic view of revisions. Includes a column for moderation state, but does not disable revert button for current revision. Might need a custom plugin for that?
Comment #3
kim.pepperOoops. Bad patch. Let's try this one.
Comment #4
jibranLooks great. Next step would be to add
hook_view_data_alterin $module.views.inc file with disable revert data on node you can have a look at$data['node_field_revision']['link_to_revision']inNodeViewData.Comment #5
kim.pepperI had a go at Jibran's suggestion, and was able to get my own custom link plugin 'Set Current' to work, however the logic of _not_ displaying it for the current revision didn't quite work.
Comment #6
jibranWorking on this.
Comment #7
kim.pepperReroll....
Comment #8
jibranHere we go.
Added sorting, page title and set page as a menu tab.
Injected dependencies and updated plugin.
Before enabling view.
After enabling view.
Comment #9
larowlanDo we want to get this in now or need tests first?
Looks good
Comment #10
jibranSome functional tests would be great. Let's wait for @dawehner review maybe UX review if possible.
Comment #11
dawehnerThe patch looks pretty reasonable. Also sorting by changed on the revisions is exactly what you need.
So yeah maybe some form of test coverage would be nice. https://github.com/Jaesin/content_entity_base/blob/master/tests/src/Kern... tests something really similar already.
Comment #12
kim.pepperPosting work in progress on the view test.
Not sure how I set moderation state on a node created programmatically?
Comment #13
jibranIt is passing now so add as much asserts as you like.
Comment #14
jibranScope of test should be public.
Comment #15
jibranTurns out we don' t have to call
$node->setNewRevision(TRUE);.moderation_state_node_presave()is handling that.Comment #16
dawehnerIMHO sprintf here is not worth it, just concat the strings as needed. Sprinf is IMHO for more generic functionality, where you have arbitrary strings and arguments.
Comment #17
kim.pepperAdded asserts to the test and found a legitimate bug. In the test, we get all the operations for the published revision, whereas in manual test this patch only shows 'view' for the published node.
Comment #18
kim.pepperHere's a screenshot of the what the tests is generating.
Comment #19
dawehnerYou should setup individual timestamps if you care about order.
Comment #20
kim.pepperThanks @dawehner.
I've ensured there are different revision timestamps, however, it doesn't seem to affect the order of the view in the test. Manual testing works fine.
Comment #21
dawehnerhonestly I would just hardcode a number and not use
time()Should I give that a try and debug that?
Comment #22
dawehnerThis is not really the field you are looking for. This is the revisioned changed field, not the time when the revision got created (according to the api).
{node_revision}.revision_timestampis what you ideally look forward to.Well, sounds easy, let's just use that in views, done.
In reality its a bit different. It turns out the join from
{node_field_revision}to{node_revision}is defined the wrong way round,so that field never appears in the UI because views cannot resolve the dependency path.
Comment #23
larowlanlooking
Comment #24
larowlanThis passes for me, pushed to branch
Uses the UI instead of the API, and in doing so increases our test coverage - found a bug with permission in the widget and a bug with _original_delta in the widget.
Fixed both in process.
Comment #25
larowlanComment #26
dawehnerI'm sorry but we should sort by the right value, not what works because of implementation details. The revision_timestamp field is supposed to be used IMHO here
Comment #27
dawehnerSure this base work is great, maybe add a TODO to switch over once #2630886: Correct the join from revision data table to revision base table is in.
IMHO using UI only tests is the wrong thing given we rely on the wrong assumptions.
@larowlan
Are you sure the interdiff is the right one?
Comment #28
jibranThanks @larowlan for looking into it. Nice feedback @dawehner.
I agree so I applied #2630886-3: Correct the join from revision data table to revision base table and updated the view.
Reverted that part from the test.
@larowlan can you please create a new issue for this?
This is done imo. We are postpone on #2630886: Correct the join from revision data table to revision base table.
Nice work @kim.pepper can you reroll core patch in #1863906: [PP-1] Replace content revision table with a view as well?
Comment #29
jibranComment #30
dawehnerLooks good to go for me!
Comment #31
kim.pepperRTBC from me also.
Comment #32
jibranNeeds reroll.
Comment #33
Crell commentedHave we investigated how this view plays with Diff? I just tested 8.x-1.x with Diff module, and it works swimmingly. If we're going to take over the Revisions tab, we need to make sure Diff continues to work.
Comment #34
dawehnerThis is indeed a tough question.
Diff module, by construction, needs a form in order to be able to do its comparison feature (at least for now).
Currently diff just takes over the existing route from node module (but we are working on something else: https://www.drupal.org/node/2634212 ).
Once we have a generic revisions overview route (https://github.com/fago/entity/pull/18 tries to do that), diff would probably still override the entire controller.
My general thought was that with views being quite flexible someone could make a diff <-> views integration so you can configure a view which looks like a diff (through the same mechanism as exposed filter), but NOT a automatic working solution. N^2 integrations are hard.
Comment #35
Crell commentedComment #36
dawehnerThere we go #2636406: Add a views form integration for diff exists now. I would argue given that we could proceed from here on.
For other entity types someone could write something like a views generator (wizard *hint *hint*) which makes that easier.
Comment #37
Crell commentedTo ensure no loss of functionality, I'm going to mark this as postponed on that one. But yes, I like the approach of just making Diff cleaner.
Comment #38
dawehnerFeels like process for the sake of process.
This patch would be still identical, people would just configure it different when they have diff enabled on their side.
If they want the diff controller instead, they would just disable the view provided by moderation_state and be done.
Comment #39
Crell commentedComment #40
kim.pepperStraight re-roll.
This will break because of the PSR-4 namespaces is all messed up from switching from moderation_state to workbench_moderation.
Comment #41
dawehnerwe need to adapt that
Ideally we would write that class independent from the entity type
namespace stuff.
Comment #42
jibran#2630886: Correct the join from revision data table to revision base table is in.
Comment #43
kim.pepperLooks like that^ wasn't completely committed. Waiting for that to go in properly.
Comment #44
jibran@catch just recommitted it.
Comment #45
josephdpurcell commentedComment #46
arknoll commentedDoes anyone have a status of this issue?
Comment #47
Crell commentedIt's on hold until Diff module figures out what it's doing, so that we don't bump into Diff. I don't want to add a View here that ends up being incompatible with Diff.
Also, this patch is probably needed, too: #2674520: Add current revision filter to views.
Comment #48
juampynr commentedI see three ways to tackle this:
1. We could either wait for this core issue that turns the listing into a view: #1863906: [PP-1] Replace content revision table with a view.
2. @dawehner sent at patch that does the same thing at the Diff issue queue: #2636406: Add a views form integration for diff.
3. @EclipseGC suggested once that we could use a contrib module that solely takes care of this, so then modules such as Diff or WM can depend on it and extend it.
How about if we create a contrib module such as views_revisions that contains the patch at #2636406: Add a views form integration for diff? We could use this module for 8.0.x and 8.1.x, while for 8.2.x we hopefully will have it in core thanks to #1863906: [PP-1] Replace content revision table with a view.
Comment #49
arknoll commented@juampynr, @crell, I think creating the contrib module gives us the most flexibility.
Comment #50
Crell commentedIf someone writes such a contrib module, I'm OK with integrating with it. But someone would have to show me how to cleanly insert new columns into someone else's View. :-) (I'd also not make it a dependency, but an optional integration.)
Comment #51
dawehnerYou simply don't. Drupal is a system which allows you to configure how the site behaves, so let's just people use views and be done. If you can configure diff and WB, why would you have not learned views in the first place.
Comment #52
jibranLet's just replace core content revision page here and after #2636406: Add a views form integration for diff we can update the existing view in follow up.
Comment #53
Sonal.Sangale commentedComment #54
Sonal.Sangale commentedComment #55
mlncn commentedSorry for the spam, but for someone looking for this, it is now possible without Workflow Moderation with this module proposed to perhaps become part of Diff: https://www.drupal.org/project/diff_moderate