Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
filter.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Aug 2015 at 15:12 UTC
Updated:
10 Sep 2015 at 12:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
claudiu.cristeaLet's see this.
Comment #3
claudiu.cristeaForgot the interdiff.
Comment #4
claudiu.cristeaThe "test only" patch.
Comment #5
xjmComment #6
alexpottNice find. And the test and fix is looking good.
If it disabled it is not "missing".
Comment #8
claudiu.cristea@alexpott, yes I noticed that but because of UI of formats, this is a little bit confusing for users because they cannot see disabled formats. For them "disabled" looks like "removed". But this is tackled in #2502637: Disabled text formats can't be seen in the GUI.
Added different message templates.
PS: IMO, that message doesn't help too much the site builder. There's no call-to-action there.
Comment #9
claudiu.cristeaA side note: Right now we set the
$element['#markup']to an empty string for such cases. That means the field surrounding markup (divs, etc.) is still outputted. And I think this is not OK. The correct way would be to set$element['#access'] = FALSE;but I think this is too late in this stage because the access check occurred in an early stage.Comment #11
claudiu.cristeaBeta evaluation.
Comment #12
claudiu.cristeaOuch!
Comment #13
tim.plunkettIf we're going to make this distinction, we should test it.
Comment #14
tim.plunkettWe have $format->status() available to us.
However, this doesn't take the fallback filter into account. Sure, in theory it can't be disabled, but still.
Thirdly, we have $format->access('use'), which for some reason does not check status.
We should get this right, this should never have been a bug.
---
Maybe something like this? Not sure how/if to fix FilterFormatAccessControlHandler.
Comment #15
claudiu.cristea@tim.plunkett, maybe we need to open a followup for that?
Comment #16
dawehnerWe should explain this particular line with a comment.
Comment #17
alexpottWould it not be better to throw an exception in the
disable()method if someone tries to disable the fallback format?Comment #18
claudiu.cristea@alexpott, I would do that inside
::disable()and keep the parent::status().EDIT: Ah, it's the same you proposed, sorry :)
Comment #19
alexpott@claudiu.cristea yep and then there is no need to override status in FilterFormat
Comment #20
claudiu.cristea@dawehner, @alexpott, moved the fallback issue in
::disable()as exception throwing.@tim.plunkett,
Researching this and found that it doesn't work. The
'use'access check is not for showing content to the end-users but to access that text format as a content editor. And here the case is that we have to decide to render content. So, it's a no.Comment #21
claudiu.cristeaAdded test coverage for
disable()exception.Comment #22
claudiu.cristeaComment #24
claudiu.cristeaI canceled the test because I forgot a
sprintf()function inside. See the last interdiff — that is valid except I removed the useless function.Comment #25
claudiu.cristeaFixing message. Thanks @stefan.r
Comment #26
alexpottThis should just do an assertion against the message... doing an if means that a LogicException with a different message would produce a false positive.
Comment #27
claudiu.cristeaYep, forgot how to catch the exact exception.
Comment #28
geertvd commentedWe still don't test the 'Missing text format' message. Shouldn't we?
Comment #29
geertvd commentedSomething like this maybe?
Comment #32
claudiu.cristea@geertvd, it's not in the scope of this issue. Let's not mess this issue with off-topic tests.
Comment #33
claudiu.cristeaComment #34
geertvd commented@claudiu.cristea, sorry patch in #29 is missing the
FilterStatic.phpfile, #27 should probably be re-uploaded thenComment #35
claudiu.cristeaPatch for review is #27. Hiding others.
Comment #36
wim leersThe actual changes look good, but the tests need a bit of work:
Nit: s/it's/is/
Nit: s/having/using/
Why?
And if we indeed want to keep this: s/as/as the/
The wording here feels a bit off. What about:
Unnecessary, can be deleted.
This first
$format->save()can be removed.Why this very special string if we are merely asserting the absence? Seems like it could simply be
$body_value = $this->randomName().s/FilterStatic/FilterTestStatic/
(All other test-only filters are named
FilterTestSOMETHING.)Also, why isn't
FilterTestReplacealready sufficient for the needs of the tests added in this patch?Comment #37
dawehnerLooking into it.
Comment #38
dawehnerThe test passed, so I just removed it.
Yeah we add both & and < in the random string code.
Well, the other one seems to do more, and we want to stay explicit here ...
Comment #39
wim leersGood call!
Again good call :)
This could be improved by a native speaker on commit.
I think the "regardless of what input text he receives" can simply be omitted. Can be fixed on commit.
Comment #40
wim leersI quickly fixed #39.3 and 4 myself. In fact, the entire comment mentioned in 3 can be deleted, "fallback format" already says plenty.
Keeping at RTBC because these are just minor comment changes.
Comment #41
alexpottCommitted bb39343 and pushed to 8.0.x. Thanks!