localgovdrupal / localgov

Installation profile for the LocalGov Drupal distribution.
GNU General Public License v2.0
82 stars 18 forks source link

Send email when user submits a revision log message to a page #708

Open NDITGC opened 4 months ago

NDITGC commented 4 months ago

Hi there,

Seeing as an email gets sent for a page's review date expiry, I'm curious to see if others would be interested in email messages being sent when a user adds a revision log to a page?

Thanks :)

snpower commented 4 months ago

Hi George,

I'm conscious that not everyone will want this, so we'll need to make it optional.

I also want to pick apart your requirement a bit more.

  1. Do you want an email notification to be sent on every edit?
  2. Or just edits which have a revision log entry?
  3. Or just edits which change workflow state?
  4. And who gets notified? Is it the author? or maybe users with a particular role?
  5. Do you have the standard LGD publishing workflow or have you customised it?

When we did it before we usually implemented it to option 3 (so state change) and then depending on the transition we notified the author (when the content was returned for amendments or was published) and reviewers only when it was marked as 'needs review'.

Thanks

NDITGC commented 4 months ago

Hey Stella,

To answer your question:

  1. Not everyone no, but this could be useful if I was able to subscribe to a page and keep updates on any changes to it.
  2. Revision log entries would mean I have a comment notifying me of what has changed, from the last editor, which would help me have a message instantly. Rather than me chase.
  3. This could be useful but depending on the page, again I think if I could choose to subscribe to which I'd want to know, rather than an email for every and all workflow states being changed
  4. As the website admin I would like to have this due to my role in Drupal, so if you were an admin I imagine that would be reasonable. At least for how we work at my org
  5. I have the standard workflow. I do not actually have the new workflow email notification yet.

Of course we now have the review state but I wonder what other notifications of a change to a page one could subscribe to.

How I imagine something like this could work is by, having a field in the editor with a on/off switch for notifications and perhaps some specific types of notifications for actions and changes that can happen to the page.

So like your questions: a tickbox for "notify logged in user when a change to page state (to draft for example)", "send revision log messages as email", "change to page title/body" etc.

A simple start could be a email notification when a page has been updated with a log of date and time and the revision message that was submitted with it, which could be a good MVP?

Thanks for your quick reply.

Kind regards,

George

stephen-cox commented 4 months ago

Subscribing to get notifications on content changes is something quite different to what we've done recently, although the email sending part can be reused. It would require a widget in the UI to allow users to subscribe to individual bits of content. With Drupal 7 the Flag module was often used for the subscription logic, not sure if there's a better alternative these days.

Having a role that receives updates is more straightforward as it only really needs the logic to enqueue notifications and a Mailer Policy, the email notification stuff in LocalGov Workflow Notifications will handle sending emails.

snpower commented 4 months ago

Yeah, I think it would be easier to implement it based on roles, rather than users. We've done both - we use users on our own website actually but it's a curated list. Based on roles would be much simpler and probably have a wider use case.