Closed (fixed)
Project:
Drupal core
Version:
9.2.x-dev
Component:
content_moderation.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
5 Jun 2018 at 12:57 UTC
Updated:
24 Jun 2021 at 12:44 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #2
timmillwoodDoes this need to be a static function?
Comment #4
timmillwoodAwesome, looks like we already have a test for this, it just needs updating.
Comment #6
alexfarr commentedThanks for the review Tim, I have actioned the change from a static function to a normal method. I have also updated the test to check for the description.
Comment #7
sam152 commentedThis method is missing a docblock describing what it does and should also be 'protected' visibility.
We can actually eliminate the method entirely and turn it into a one-liner:
Where 'State' is imported from
Drupal\workflows\State.We could get probably try to get fancy with conditional plural formatting for state/states, but I don't think it's warranted. This is a big improvement as it stands.
Comment #8
alexfarr commentedSimplification made, thanks for the review.
Comment #9
alexfarr commentedComment #10
sam152 commentedLooks good to me.
Comment #11
alexpottYep this is better but I think we should use
->formatPlural()to cope with the multiple from states. It's not that much of an onus. And it'll mean that we have the correct strings for translators first time.Also this is more a task than a feature.
Comment #12
alexfarr commentedHere is the patch with the pluralised message.
Comment #13
alexpottLooks like this tests should fail.
Also funnily enough - is the word "state" or "states" that useful? Maybe the message could be "Change state from Draft, Published to Published" hmmm.... but I guess there you'll need an or which is even harder.
Comment #15
alexfarr commentedI have updated the test so it does not fail. However, I have not updated the test to include a singular state. I have spent some time trying to get the permissionsTestCases() data provider to build a simple workflow but failed. The alternative would be to add extra fixture data, but I am unsure if this is the right process. I will need some guidance to take these tests further.
Comment #16
alexfarr commentedComment #17
sam152 commentedHere is the expanded test case. I had a crack at implementing the suggestion in #13, it looked something like:
and the test cases ended up looking like:
I don't really mind either one, I'm not sure the benefit is worth the complexity, but happy to see what others think. One thing to note is, the "or" would always have to be part of the
<em>placeholder string, because there is a dynamic number of from states. Doesn't read that nicely to have parts of the sentence classed with "placeholder", given we're trained to treat that as the "variable" part of messages.Comment #23
joachim commentedLGTM.
Comment #24
catchNeeds some help to get past DrupalCI after nearly three years.
Comment #25
neslee canil pintoUpdated patch as per #24
Comment #26
joachim commentedThanks for the reroll!
Comment #29
catchCommitted/pushed to 9.3.x and cherry-picked to 9.2.x, thanks!