collective / sc.social.like

Social: Like Actions is a Plone package (add-on) providing simple Google+, Twitter and Facebook integration for Plone Content Types.
7 stars 23 forks source link

Should work with workflows without a "published" state #148

Open rafaelbco opened 6 years ago

rafaelbco commented 6 years ago

Sometimes a workflow does not have a published state. In my case I have something like published_external. The following line checks if the content item is in the published state to determine if the viewlet is enabled:

https://github.com/collective/sc.social.like/blob/2e67159bc1e6c9008cf38b5ba2e6b53d4dec646f/sc/social/like/browser/viewlets.py#L53

As a result I cannot use the add-on because my workflow does not have such a state.

I think the best way to solve this is make it configurable in the control panel as a set of workflow states for which the viewlet should be enabled.

hvelarde commented 6 years ago

yes, I knew that when we implemented the feature; now that you have a use case we can start thinking on how to solve this.

before creating a new option on the configlet I would like to find out if there's a canonical way of declaring a public state in Plone. can you help me on that?

another option is to show the viewlet always again; we implemented this change because we had a lot of code being loaded there before (all JS from widgets) and that was making the page rendering slow on unpublished content.

now the only JS code that loads there is Facebook's; we can find out a way to decouple it from the main viewlet.

rafaelbco commented 6 years ago

before creating a new option on the configlet I would like to find out if there's a canonical way of declaring a public state in Plone. can you help me on that?

I don't think such thing exists :disappointed:. Perhaps you can explain the situation on the Plone forum and see what people have to say.

another option is to show the viewlet always again;

Actually I like the idea of being able to restrict sharing only for public items. If the new option "list public states" is implemented then we could make an empty list mean that the viewlet will always be displayed.

For now I monkey patched my way around the limitation, so there's no hurry to implement a fix from my part.

hvelarde commented 6 years ago

the site Navigation configlet has something that can help us to build the prototype of this new option:

screenshot-2017-10-5 rede brasil atual