collective / collective.ifttt

A Plone addon which enables any Plone site to play in the IFTTT (pronounced /ɪft/) ecosystem by allowing you to create IFTTT applets.
GNU General Public License v2.0
2 stars 0 forks source link

Suppress content rules info message #65

Closed skleinfeldt closed 6 years ago

skleinfeldt commented 6 years ago

When I successfully add an IFTTT Content Trigger I get a successful info message from c.ifttt, plus a misleading info message from content rules:

ifttt-info-msgs

Can the content rules message be suppressed?

Shriyanshagro commented 6 years ago

@skleinfeldt I have mentioned this issue long back to @datakurre. But then we decided to let @tkimnguyen to take a call on it, whether we should suppress it or not?

skleinfeldt commented 6 years ago

That's good that you noticed and discussed this. I think it's safe for me to make the call for @tkimnguyen - this message is just confusing for people who don't know (or want to know) anything about content rules, so it should be suppressed.

datakurre commented 6 years ago

I assume that queued status messages can be cleared with

from Products.statusmessages.interfaces import IStatusMessage
IStatusMessage(self.request).show()
Shriyanshagro commented 6 years ago

@datakurre this method removes all the messages, even the ones which are added after it is being called.

datakurre commented 6 years ago

I don’t understand how it could remove messages added after call :/

Shriyanshagro commented 6 years ago

Yes, I too don't understand the magic. But that's happening. I called it just after the creation of the content rule. https://github.com/collective/collective.ifttt/blob/3ea56fff523eea0ede62d674340496ac661c3f8e/src/collective/ifttt/utils.py#L63

datakurre commented 6 years ago

I believe they are stored as an annotation on the request. You could be able to delete those manually by following https://github.com/plone/Products.statusmessages/blob/master/Products/statusmessages/adapter.py

just use IAnnotations(self.request) and the the storage key constant