Reviewed & tested by the community
Project:
Workbench Moderation
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jun 2016 at 18:35 UTC
Updated:
23 Sep 2016 at 22:34 UTC
Jump to comment: Most recent, Most recent file



Comments
Comment #2
pericxc commentedComment #3
pericxc commentedComment #4
jhedstromI wonder if for both this issue, and over in #2738903: Multiple moderation states with the same label are confusing in the transition UI if we should rather than always add the machine name, first check to see if there are any duplicatly named transition states? That way, simple sites would continue to get the UX they have now without the machine name, and more complex sites would get the clarifying machine name.
Comment #5
pericxc commentedComment #6
pericxc commentedComment #7
pericxc commentedComment #8
pericxc commentedI just created a new patch with changed logic. First it will to check if there are any duplicately named transition states, then only for those will add machine name.
Comment #9
pericxc commentedComment #10
jhedstromThis is looking really good.
One nitpick:
Protected functions are preferred to private in Drupal coding standards.
Comment #11
jhedstromAlso, we need to make sure this method will allow the work in #2738903: Multiple moderation states with the same label are confusing in the transition UI to use the same logic. If not, a more general utility method should be introduced I think.
Comment #12
pericxc commentedComment #13
pericxc commentedThe latest patch contains changes that will take care of #2738903: Multiple moderation states with the same label are confusing in the transition UI.
Comment #14
jhedstromSince this is being used for both permissions and moderation state forms, perhaps the new method (
getUniqueLabels()) should be on theModerationStateInterfaceinterface (and thusModerationStateclass) itself?Comment #15
pericxc commentedmake sense, but It also should be added to the ModerationStateTransition and ModerationStateTransitioninterface.
Comment #16
pericxc commentedComment #17
pericxc commentedComment #18
jhedstromOne last nitpick and I think this is ready!
While this probably won't matter here, in general, rather than
self::,static::is preferred since then final control of which method is used is left to the implementing class (see Late static bindings for further detail).Comment #19
pericxc commentedComment #20
jhedstromThis looks great. For simple sites, there will be no noticeable change to the UI, but for complex sites with multiple transitions that might share a label, this is a big usability enhancement.
Comment #21
larowlanThis is essentially the same code - could we have it in a trait instead?
Other than that, I reckon this is ready to go
Comment #22
pericxc commentedComment #23
pericxc commentedComment #24
jhedstromThis looks good to go!
Comment #25
swathikris commentedHi @pericxc, thanks for this enhancement where in machine_name is displayed if there were any duplicate state label names.
We'll need to display machine_name in 'Manage moderation' page. While any content type enables moderation, machine_name display on this page is very helpful. Please see the attached screen grab - missing machine_name in Manage moderation.png
Thank you
Comment #26
pericxc commentedComment #27
webchickFollowing up from #2757349: WI: Deal with scalability issues in the UI, which mentioned the cluttering of the permissions page. This patch unfortunately makes it worse. :( Spun off #2766467: Permissions: Make the permission description the name and drop the description to cut down UI clutter to talk about fixing this, since the other changes look good.
Comment #28
pericxc commented@webchick, you mentioned there are scalability issues this patch introduces, which is the valid point. Just wondering what are the next steps to get this patch committed?
Comment #29
webchickThat I don't know, since I'm not a maintainer of this module. I'm guessing though that one of them will see this and respond soon. :)
Comment #30
larowlanAs pointed out in #25 I think this 'fix it where we see it' approach is bound to miss some places.
Going to try a different approach.
Comment #31
larowlanThis is the approach.
So the default
label()method will always return the unique label.No need to override it elsewhere.
Then if we need a non-unique label (eg in places where showing the original value in the form or when we're showing the nice names in the content edit form and machine names are inappropriate) we pass FALSE argument.
That way every other place the label is shown that there are duplicates, we don't need special code.
We can control when we are calling
label(), but we can't control every other place in core and contrib etc. So we flip it.This way, the default behaviour is enough.
Screenshots show no difference to previous patch.
Thoughts?
Comment #32
larowlanAlso @pericxc to answer your question, I'm doing reviews of RTBC issues in modules I maintain every Friday with view to commit. This one was on today's list but I think we're not quite there yet.
Comment #33
pericxc commented@larowlan, that's great. It also resolved another issue, I was about to create, on page "admin/structure/workbench-moderation/transitions". machine_names are now displayed!
Comment #34
pericxc commented@larowlan, so two things has to be done: a test and related suggestions from https://www.drupal.org/node/2766467, right?
Comment #35
pericxc commentedA small change related to #2766467
Comment #39
pericxc commentedComment #40
pericxc commentedComment #41
pericxc commentedComment #42
pericxc commentedIn the last patch I removed description and added Web Test.
Comment #43
chx commentedIf I were writing this:
Comment #44
pericxc commented@chx, yep. changing it. thx.
Comment #45
pericxc commentedComment #46
pericxc commentedComment #47
jhedstromI think this has addressed all the outstanding points above. The code going in here can be refactored as needed for #2766467: Permissions: Make the permission description the name and drop the description to cut down UI clutter without too much effort I think.
I've manually tested this as well with multiple states with the same label.
Comment #48
larowlanThanks, will commit on Friday all going to plan
Comment #49
alexpottWhy don't we enforce unique labels?
Comment #50
jhedstromSites with many different workflows can have the same label (eg, Draft) for multiple states since these are site wide, and a state transition for one entity type might have completely different permissions than a state for another entity type.
Comment #51
alexpottI think core is planning on going a different way here. Having global states and transitions doesn't really make make sense. We're thinking of taking a similar approach to workflow. See #2779647: Add a workflow component, ui module, and implement it in content moderation
Comment #52
jhedstromAdding related core content moderation issue.