Now that #2634212: Offer a diff controller for all entity types leveraging entity API module has landed, we have 2 controllers, which are almost identical.
#2752725: Turn EntityComparisonBase into a service moves 50% of the original controller logic into a service, but still leaves the other 50% in the controllers.
Either NodeRevisionController should be removed, and the routing changed so that only GenericRevisionController is used, or if we need 2 controllers then the duplicate logic should to be moved to EntityComparisonBase.
We tried to remove it, but ran into permissions issues in the resulting routing, so it's not a completely trivial issue.
Priority Major because it complicates development efforts having to keep 2 near-identical controllers in sync.
Comment | File | Size | Author |
---|---|---|---|
#25 | interdiff-2759627-22-25.txt | 1.75 KB | johnchque |
#25 | remove_redundant-2759627-25.patch | 18.05 KB | johnchque |
#22 | interdiff-2759627-20-22.txt | 1.05 KB | johnchque |
#22 | remove_redundant-2759627-22.patch | 18.09 KB | johnchque |
#20 | interdiff-2759627-19-20.txt | 2.25 KB | johnchque |
Comments
Comment #2
jonathanshawComment #3
jonathanshawThe simplest possible fix would seem to be:
a) change "\Drupal\diff\Controller\NodeRevisionController::compareNodeRevisions" to \Drupal\diff\Controller\GenericRevisionController::compareEntityRevisions in the diff.routing.yml and DiffRouteProvider.php
b) move the revisionOverview function across from nodeRevisionController.php to genericRevisionController.php and change routeSubscriber.php to point to new location
However, just making the first change in diff.routing.yml leads to a permission denied issue when trying to view a node diff.
Comment #4
johnchqueComment #5
jonathanshawGlad you're working on this @yongt9412, it's beyond me. When you've done it, I'll reroll #2752725: Turn EntityComparisonBase into a service on top of it.
Comment #6
johnchqueThanks @jonathanjfshaw.
This is an early patch, not really sure if we can have security problems here. But it works as far as I tested.
Comment #8
BerdirI don't think those changes are correct, we still use our route now?
Comment #9
johnchqueactually yes, just changed it to make it fit. Should I keep it as it was?
Comment #10
johnchqueOk, let's start again, tried something different. seems to work.
Comment #12
johnchqueThis should fix the tests. :)
Comment #13
Berdirhm, why change the slug names? We want to get rid of this eventually completely but until then, I'd try to keep the changes as minimal as possible.
ah, I see why you tried to rename...
but this is not a url, it is a route name.
Comment #14
johnchqueAdded diff route function. Just not really sure if the diff_route function should avoid changing the variables on the route for leaving it as left_vid and right_vid?
Comment #16
johnchqueStrange, it passes locally.
Comment #17
johnchqueComment #18
Berdiryou should be able to replace this one now too?
Looks like all the calls are on this controller, so maybe better to make a non-tatic method here?
Comment #19
johnchqueRefactored more code. Moved the function. :D
Comment #20
johnchqueBetter now probably?
Comment #21
Berdirboolean seems to restricting.
Just add $filter as argument, NULL by default, if set, add it to the parameters.
Comment #22
johnchqueChanges made.
Comment #24
johnchqueComment #25
johnchqueI was blind! This should work better!
Comment #26
BerdirI think this looks good now.
Comment #27
miro_dietikerYay, committed. :-)