? Success

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
15 Oct 2013

This PR moves the contact query out from the com_content models into a new content plugin and thus finally decouples com_contact from com_content.

The plugin will search for a contact for a given user and adds the contactid and the profile page contact_link to the item.

This approach should be backward compatible with existing templates, as they are currently reading the contactid and create the link to the profile page.

The nice thing with this approach is that if a template is updated and uses the new contact_link, it will be possible for other extensions to provide plugins which link the author to their own profile pages.

There are some other nice sideeffect:

  • Database queries in the com_content models are simpler and less likely to break. We struggled with this contact join several times already in the past, ranging from dropped items (no contact for an author) to duplicated ones (multiple contacts per author especially with multilanguage).
  • Contact query is not run when it's not used on a site. Simply disable the plugin.
  • It should be possible to uninstall com_contact now without breaking the site. However I wouldn't put my hand into a fire for this :)

Tracker:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32318

avatar Bakual Bakual - open - 15 Oct 2013
avatar wilsonge
wilsonge - comment - 15 Oct 2013

Thankyou for taking over this :) Something I've been meaning to push for a while!!

avatar Bakual
Bakual - comment - 24 Oct 2013

Updated to master

avatar betweenbrain
betweenbrain - comment - 8 Jan 2014

@Bakual can I be a pain and ask that you update this to master so it can be tested and hopefully merged.

avatar Bakual
Bakual - comment - 8 Jan 2014

@betweenbrain Saw it just the second after I posted on Twitter :smile:
Unfortunately the conflicts are coming from some changed SQL files... I'll dig into it this evening.

avatar betweenbrain
betweenbrain - comment - 8 Jan 2014

@Bakual Thanks! Let's this one in, it's way too important to gather digital dust.

avatar Bakual
Bakual - comment - 8 Jan 2014

Updated and moved the update sql stuff to new SQL files.

avatar gwsdesk
gwsdesk - comment - 12 Jan 2014

Posted successful test on tracker. Tested this afternoon and works like a charm
You may blame the J!Tracker Application for transmitting this comment.

avatar Bakual
Bakual - comment - 12 Jan 2014

I found two issues why the featured view didn't work.

  • One in the plugin because it checks for a specific context and the featured was missing.
  • The other is in the featured view itself, where the non-existant $this->params was passed to the onContentPrepare event. It should be $item->params instead. That's actually an unrelated bug :smile:

I'll update the PR with those changes. Thanks for the good testing!

avatar Hackwar
Hackwar - comment - 12 Jan 2014

Remind me to buy you a beer. The code looks good, I will test this this afternoon.

avatar dbhurley
dbhurley - comment - 12 Jan 2014

This is great Thomas! I would like to test this afternoon as well. We
needed to decouple these and this code looks good (I like Hannes
suggestions too.)

One step closer to being able to package everything separately! :)

Thanks,
David Hurley
On Jan 12, 2014 7:19 AM, "Thomas Hunziker" notifications@github.com wrote:

I found two issues why the featured view didn't work.

  • One in the plugin because it checks for a specific context and the featured was missing.
  • The other is in the featured view itself, where the non-existant $this->params was passed to the onContentPrepare event. It should be $item->params instead. That's actually an unrelated bug [image: :smile:]

I'll update the PR with those changes. Thanks for the good testing!


Reply to this email directly or view it on GitHub#2256 (comment)
.

avatar gwsdesk
gwsdesk - comment - 12 Jan 2014

As mentioned on Tracker: Also Featured is now working.

Cool!

Leo Lammerink
On 1/12/2014 7:45 PM, David Hurley wrote:

This is great Thomas! I would like to test this afternoon as well. We
needed to decouple these and this code looks good (I like Hannes
suggestions too.)

One step closer to being able to package everything separately! :)

Thanks,
David Hurley
On Jan 12, 2014 7:19 AM, "Thomas Hunziker" notifications@github.com
wrote:

I found two issues why the featured view didn't work.

  • One in the plugin because it checks for a specific context and the featured was missing.
  • The other is in the featured view itself, where the non-existant $this->params was passed to the onContentPrepare event. It should be $item->params instead. That's actually an unrelated bug [image: :smile:]

I'll update the PR with those changes. Thanks for the good testing!


Reply to this email directly or view it on
GitHub#2256 (comment)
.


Reply to this email directly or view it on GitHub
#2256 (comment).

avatar beat
beat - comment - 12 Jan 2014

Great addition Thomas ! :+1:

One suggestion proposal to completely uncouple com_content from plg_content_contact :

com_content should actually become completely unaware of plg_content_contact, and that seems with your PR to be almost the case, which is great :+1:

However 3 small areas remain that could make it completely decoupled:

1) The html generated in case of a contact_link present in content should become part of the contact content plugin.

2) The data (link) stored for the contact link, while ok to be in the contents table, is still managed by com_content instead of the plugin

3) The settings for it are still generated by com_content instead of the plugin.

Those 3 things are not mandatory for this step in the right direction, but could become part of it, either in this PR or as separate feature.

The Observer pattern (Observer relation to be defined by the plg_content_contact plugin), applied to the Model for "2" and View for "1", as well as the extensions ability of JForms for "3" could be elegant solutions to this,

avatar gwsdesk
gwsdesk - comment - 12 Jan 2014

I actually like Beat's suggestions and care for point 1 and 3 especially. Think that settings indeed should be completely of com_content and be in the plugin. I am not a coder but assume that should not be too hard probably?

avatar Hackwar
Hackwar - comment - 12 Jan 2014

In favour of backwards compatibility and not introducing a completely new system in a maintenance release, I would not move the contact specific HTML code out now, but do that in a bigger change later. If we introduce a change like this, we should have an overall strategy for likewise implementations and I don't see us having that right now.

avatar gwsdesk
gwsdesk - comment - 12 Jan 2014
  • 1 Did not think that far (backwards compatibility) . Makes sense to introduce that maybe in 4.0 or whatever we are going to call it? On 1/12/2014 8:11 PM, Hannes Papenberg wrote: > > In favour of backwards compatibility and not introducing a completely > new system in a maintenance release, I would not move the contact > specific HTML code out now, but do that in a bigger change later. If > we introduce a change like this, we should have an overall strategy > for likewise implementations and I don't see us having that right now. > > — > Reply to this email directly or view it on GitHub > #2256 (comment). >
avatar beat
beat - comment - 12 Jan 2014

As said, my suggestions could be different PRs and done later.

Not sure why changing differently the already changed lines in this PR would affect BC.

Making it completely uncoupled would allow typically to write other plugins that link to the author's twitter, or add a Facebook icon for the author profile, or link it to your favorite social component installed instead of (or in addition) of contact link. Actually the author text can already be changed onPrepareContent trigger. But, if the Observable implementation of the View is done right, it would allow very easily adding features to Content too.

avatar gwsdesk
gwsdesk - comment - 12 Jan 2014

That is a fair statement Beat and I like the suggestions of the other
plugins. That indeed would enhance and improve very much the
opportunities. If that can be achieved simple now we should do it me
think to avoid 'forgetting it" afterwards when we have committed current
patch however I also see the advantage of committing it now since it
finally resolves a long standing issue we have had I am not sure what is
best but again I leave that to people who know code and how hard or
simple it would be to implement your good suggestions now Beat....
Priority should be that this is being committed now and we polish it in
a later stage.... Opinions?
On 1/12/2014 8:15 PM, beat wrote:

As said, my suggestions could be different PRs and done later.

Not sure why changing differently the already changed lines in this PR
would affect BC.

Making it completely uncoupled would allow typically to write other
plugins that link to the author's twitter, or add a Facebook icon for
the author profile, or link it to your favorite social component
installed instead of (or in addition) of contact link. Actually the
author text can already be changed onPrepareContent trigger. But, if
the Observable implementation of the View is done right, it would
allow very easily adding features to Content too.


Reply to this email directly or view it on GitHub
#2256 (comment).

avatar Bakual
Bakual - comment - 12 Jan 2014

It's true that it could be improved. The idea was mainly to decouple the thing in a backward compatible way. It got a big PR already by doing that.
The ability to create links for components like CB instead of com_contact is a nice sideeffect which can be improved for sure. I like the ideas Beat mentioned but don't think they should go into this PR.

The data (link) stored for the contact link, while ok to be in the contents table, is still managed by com_content instead of the plugin.

@beat I'm not sure I understand you correct here. Com_content only stores the user. There is no info about a contact here. The plugin looks that up in the contact table and adds the id and link to the article $item.

The parameters need to stay in com_content for now simply for BC reasons. Also how would you store them in the plugin? Currently you can enable/disable the linking for com_content globally, on a per menuitem basis and per article. You couldn't do that in a plugin.

avatar Bakual
Bakual - comment - 12 Jan 2014

@Hackwar Good ideas. Will probably do in the evening :smile:

avatar gwsdesk
gwsdesk - comment - 12 Jan 2014

And as soon as you are done I will test ;-)
On 1/12/2014 8:48 PM, Thomas Hunziker wrote:

@Hackwar https://github.com/Hackwar Good ideas. Will probably do in
the evening :smile:


Reply to this email directly or view it on GitHub
#2256 (comment).

avatar Bakual
Bakual - comment - 12 Jan 2014

Caching the query (thanks @Fedik) and other improvements suggested by @Hackwar.
Ready for testage :smile:

avatar gwsdesk
gwsdesk - comment - 13 Jan 2014

@test
Works like a charm

avatar infograf768
infograf768 - comment - 13 Jan 2014

@Bakual
Please update versions, date and copyright for the new files.

Can you explain what is '{"mode":"1"}' for in the sql? I do not see any params in the xml

Also, I suggest to modify the JGLOBAL_LINK_AUTHOR_DESC Tip for "Link Author" by adding with < strong > the fact that the plugin has to be enabled.

@test
this works fine. have not seen any B/C issue in multilingual.
Shall we reserve this for 3.3?

avatar gwsdesk
gwsdesk - comment - 13 Jan 2014

@test

+1 for the suggestion to reserve that for 3.3. Let's get this in the oven first?

avatar Bakual
Bakual - comment - 13 Jan 2014

Shall we reserve this for 3.3?

I've asked in PLT but didn't get a response so far. Imho it could go into 3.2 as it should be full BC, but since it's also technically a new feature it may be better in 3.3.

Please update versions, date and copyright for the new files.

Updated

Can you explain what is '{"mode":"1"}' for in the sql? I do not see any params in the xml

Copy-paste error. Removed :smile:

Also, I suggest to modify the JGLOBAL_LINK_AUTHOR_DESC Tip for "Link Author" by adding with < strong > the fact that the plugin has to be enabled.

Changed. But needs a review by someone who is native english. @brianteeman can you maybe have a look?

avatar Bakual
Bakual - comment - 13 Jan 2014

Thanks @brianteeman. Updated with your suggestions.

avatar gwsdesk
gwsdesk - comment - 13 Jan 2014

We don't need another Test for this do we?

Leo
On 1/13/2014 7:07 PM, Thomas Hunziker wrote:

Thanks @brianteeman https://github.com/brianteeman. Updated with
your suggestions.


Reply to this email directly or view it on GitHub
#2256 (comment).

avatar Bakual
Bakual - comment - 13 Jan 2014

We don't need another Test for this do we?

For language string changes it's usually enough if someone with enough english knowledge looks over it before merging.

avatar gwsdesk
gwsdesk - comment - 13 Jan 2014

I looked over it but maybe "Godfather" (smile) Brian should have the
final words here? ;-)
On 1/13/2014 8:14 PM, Thomas Hunziker wrote:

We don't need another Test for this do we?

For language string changes it's usually enough if someone with enough
english knowledge looks over it before merging.


Reply to this email directly or view it on GitHub
#2256 (comment).

avatar infograf768
infograf768 - comment - 14 Jan 2014

Another suggestion: add a post-installation message. People NOT using the linked user may be real happy to know that disabling the plugin will make their site faster. :)

avatar Bakual
Bakual - comment - 14 Jan 2014

we could do that in a new PR after this one is merged. I'd rather have it separate from this one.

avatar Bakual
Bakual - comment - 14 Jan 2014

People NOT using the linked user may be real happy to know that disabling the plugin will make their site faster.

Actually, it will not make their sites really faster. If the "Link Author" parameter is disabled, the plugin will not execute the query. Thus the only gain would be that the plugin doesn't get loaded at all if it's disabled, which is a really small gain and probably not measurable.
I'm not sure if that really justifies a post-installation message.

avatar gwsdesk
gwsdesk - comment - 14 Jan 2014

No need for post-install message according to me
On 1/14/2014 11:04 PM, Thomas Hunziker wrote:

People NOT using the linked user may be real happy to know that
disabling the plugin will make their site faster.

Actually, it will not make their sites really faster. If the "Link
Author" parameter is disabled, the plugin will not execute the query.
Thus the only gain would be that the plugin doesn't get loaded at all
if it's disabled, which is a really small gain and probably not
measurable.
I'm not sure if that really justifies a post-installation message.


Reply to this email directly or view it on GitHub
#2256 (comment).

avatar infograf768 infograf768 - reference | - 17 Jan 14
avatar infograf768 infograf768 - merge - 17 Jan 2014
avatar infograf768 infograf768 - close - 17 Jan 2014
avatar infograf768
infograf768 - comment - 17 Jan 2014

Thanks. No need indeed. Merged.

avatar Bakual Bakual - reference | - 17 Jan 14
avatar Bakual Bakual - head_ref_deleted - 17 Jan 2014

Add a Comment

Login with GitHub to post a comment