New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix introtext treatment in single article view #9964
Fix introtext treatment in single article view #9964
Conversation
$item->introtext should be assigned to $item->text when the "show_noauth" option is set and user is guest. This is in order to have the introtext correctly parsed by "onContentPrepare" event handlers. After that $item->introtext should be updated with the parsed $item->text so that templates still relying on introtext will display the correct output.
This was hackish as it would had fixed things only for this template. Not needed anymore now that the problem is fixed in the view.
I have tested this item ✅ successfully on 1621e7f This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
Thanks @andrepereiradasilva, but... you've been too quick! I'm about pushing another commit fixing another minor aspect!! 😄 |
This PR has received new commits. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
OK, ready! I got rid of the extra spurious blank that was appended to introtext when there was no fulltext... |
I have tested this item ✅ successfully on 976b4cf This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
@andrepereiradasilva, thanks again and sorry for the "double testing"! |
no problem |
I have tested this item ✅ successfully. |
Thanks for testing, @rgmears, but I think you haven't used the correct procedure to register your result (see that it doesn't reference latest commit of this PR and "Human Test Results" count is still at 1?): you have to register your test at https://issues.joomla.org/tracker/joomla-cms/9964, login with your github credentials and then click on the "Test this" blue button (above my funny face!) |
I have tested this item ✅ successfully on 976b4cf This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
@smz This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
@rgmears perfect! 👍 thanks! |
Hmmm, I'm not sure if it is a good idea to set $item->introtext = $item->text. This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
@lunalars is correct - this PR is not correct at all |
I think instead this is correct and I'll try to explain why. I think this is the only correct way to fix the the "onContentPrepare" treatment for introtext and it is exactly what is today done in As you surely know content is stored in two columns at the DB level:
there is no "text" column, and, following the MVC architecture, it is the duty of this "view" to build the When we fixed the treatment of introtext in #9865 (I'm saying "we" because that's code I pushed to your PR, Brian) we fixed only for the "Protostar" template. Millions of other sites not using Protostar are not benefiting of that "half backed fix" and I don't think this a good service to the name of Joomla who advertise itself as a "CMS": we should Manage Content in a correct way for every user, independently of which template he/she is using. The same (unhappily, IMHO) happened today with #9959, where a bug was fixed, but only for Protostar, not for the entire set of Joomla sites. I think this is unfortunate: I don't want Joomla to become a "PCMS" (Protostar Content Management System). We have two core site templates, Breeze and Protostar: many bugs are fixed for Protostar only. Breeze is neglected. I think a correct way to check bug fixes would be to verify that they work at the same time for Breeze and Protostar. If they don't, then we are doing something wrong with an hackish fix at the wrong place. We are patching things at the wrong place (unless the bug is a template specific one, that is). Technically, what that "accused" line of code (again, already present elsewhere) is changing (hint: analyse the preceding
Which sites could be affected by this? Only sites with templates ignoring the options in force, that is displaying introtext |
If you change the behaviour so that a site that was only displaying On 19 April 2016 at 13:02, Sergio Manzi notifications@github.com wrote:
Brian Teeman |
Brian, that's minutiae compared to what happened with 3.5.0 and 3.5.1 (heck, we even wiped out UCM tables for non core extensions...) and again those site would be in error... If we change an erroneous behaviour that's "fixing a bug", not "breaking B/C" |
$item->introtext should just be introtext and not introtext + fulltext or anything else. And: I am the one in a million using $item->introtext in some of the templates I created :-) This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
@lunalars You are using the non processed introtext when introtext wasn't meant to be displayed? |
You can argue as much as you want but this breaks existing sites and will On 19 April 2016 at 13:19, Sergio Manzi notifications@github.com wrote:
Brian Teeman |
This PR has received new commits. CC: @andrepereiradasilva, @rgmears This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
Happy? |
I'll leave to the PLT to decide which solution is deemed to be better: before or after a491c82 |
Just keep it logical:
I would call it a bug if introtext suddenly becomes fulltext (or whatever). This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
@lunalars can you please test with your site in a million after latest commit? Is that OK with you? |
@andrepereiradasilva and @rgmears Sorry guys, can you please retest after latest commit (with which I don't agree, but wouldn't do any harm)? Thanks! |
Ooops... that's new... Travis doesn't like // comments spanning multiple lines (but only for PHP 5.6)... Should this be fixed? Adapting my commit, anyway... |
This PR has received new commits. CC: @andrepereiradasilva, @rgmears This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
@lunalars
Actually there is not much logic in the naming of those DB columns/object attributes:
|
PLT, please beware: with latest commit I pushed following the wishes of @brianteeman and @lunalars, the behavior is fixed only in Protostar (where I have corrected the affected template to use |
@smz code style checks are running only on 5.6 |
Thanks @rdeutz ! Still think a three liner // comment is much better than a /* ... */ which will probably become a 5 liner... |
I have tested this item ✅ successfully on b0eaf3c This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
1 similar comment
I have tested this item ✅ successfully on b0eaf3c This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
I have tested this item ✅ successfully on b0eaf3c But there is a typo. "Don't do that when introtex ..." should be "Don't do that when introtext ..." |
Thanks to all testers and my apologies to @JamalTailored for not having noticed his test of more than a month ago! You're right about the typo, @rgmears... and I also think it would be sensible to change the name of that variable I introduced in a491c82 from |
P.S.: I'm still convinced that this PR was better before applying a491c82, but again I leave this to a PLT decision... |
By your own admission this breaks existing web sites - we have no idea if it is one or one million but we should not be breaking exiting sites with an upgrade This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
1 similar comment
By your own admission this breaks existing web sites - we have no idea if it is one or one million but we should not be breaking exiting sites with an upgrade This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9964. |
@brianteeman Got, it! Got it! No need to underline that again (twice). What you're probably missing is that since a491c82 that's not the case anymore... |
@smz What is the status of this PR, is it still needed? |
To be honest I don't know how to answer: the code has changed significantly since, and I don't feel confident advising if/how this should be merged. If I remember correctly, there where
|
I amended my answer above: the first issue was already resolved in another PR and only the second (architectural) issue was addressed here. |
I just noticed that in #11290 the following code has been added:
So, apparently it has been decided that the concern of content authorization must be moved down to the layout level instead of up to the view (or model) level. P.S.: I love the "usually"... P.P.S: I think the comment added in #11290 is wrong: what is usually done is to set |
Based on the comments above I am closing this |
Summary of Changes
An issue emerged in #9830 and was partially fixed in #9865 (onContentPrepare plugins not acting on introtext)
The underlying issue is that (contrary to what is done in the "Category blog" view) introtext is not "treated", even when it is the only text to be displayed due to the
show_noauth
option being in force and the user being guest.This PR fixes the above issue.
Testing Instructions / Additional comments
Testing instructions for #9865 can be used.
Compared to current staging nothing should change when using the standard "Protostar" template and the single article view template is not overridden. This is because in #9865 a fix was incorporated in the single article template for the above behaviour.
This is not anyway correct: it shouldn't be a template's concern to "prepare" the item to be displayed: this is "view" territory. The same is done in the "Category Blog" view.
This PR fixes the issue at its roots so other (old and/or overriden) templates can benefit of it.
Also, there shouldn't be (and with this fix there is none) difference between "introtext" and "text", when used at the template level (actually we should only use "text"). Again, it is "view" territory to decide what should be displayed and what shouldn't.