Skip to content
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

wiki page edit email notifications (max 1 per hour) #396

Open
jywarren opened this issue Mar 8, 2016 · 11 comments
Open

wiki page edit email notifications (max 1 per hour) #396

jywarren opened this issue Mar 8, 2016 · 11 comments
Labels
break-me-up break up for cleaner code separation, discrete tests, and, easier and iterative collaboration enhancement explains that the issue is to improve upon one of our existing features help wanted requires help by anyone willing to contribute

Comments

@jywarren
Copy link
Member

jywarren commented Mar 8, 2016

The difficulty here is managing too many notifications for subsequent edits.

Note: we could start by only doing notifications if there's been no edits for over 1 hour.

If there's a second edit, we could also start a timed job on a wiki edit which executes 1 hour later, and collects all the subsequent edits.


Email notifications, similar to comment notifications, for when someone edits a wiki page (like this page: https://publiclab.org/wiki/gsoc-ideas). Subscription would happen under the "Follow" menu:

screenshot 2016-03-25 at 11 18 39 am

Code for that menu is here: https://github.com/publiclab/plots2/blob/master/app/views/like/_like.html.erb

A good template for this is one of these:

https://github.com/publiclab/plots2/blob/master/app/mailers/subscription_mailer.rb
https://github.com/publiclab/plots2/blob/master/app/mailers/comment_mailer.rb

This'd be a little annoying on pages that get edited often, so we should check if an edit has happened in the past (maybe) 10 minutes, and send an email that "batches" all edits since the last time it could've been triggered. So instead of getting 10 emails that Alice has edited a page in 15 minutes, you'd get 2 at the most.

The email would include (potentially) the changes made (see the wiki diff display on the new dashboard: https://publiclab.org/dashboard2 (login required)): https://github.com/publiclab/plots2/blob/master/app/views/dashboard/_node_wiki.html.erb#L26-L34 and diffing code, in javascript, here: https://github.com/publiclab/plots2/blob/master/app/assets/javascripts/dashboard.js

Diffs look like this:

screenshot 2016-03-25 at 11 19 49 am

...and of course the username of the editor.

These could have the same "Look like spam?" links the research note notifications have: https://github.com/publiclab/plots2/blob/master/app/views/subscription_mailer/notify_node_creation.html.erb#L23

Recommend tackling basic notifications first, with no diffs, and opening a new issue to include diffs inline later.

This would be the preferred way to keep an eye out for spam on a page, where locking (#397) is a last resort.

@jywarren jywarren added enhancement explains that the issue is to improve upon one of our existing features high-priority labels Mar 8, 2016
@jywarren jywarren mentioned this issue Mar 8, 2016
8 tasks
@jywarren jywarren changed the title wiki page edit notifications wiki page edit email notifications Mar 25, 2016
@jywarren jywarren added help wanted requires help by anyone willing to contribute ready and removed in-progress labels Mar 25, 2016
@jywarren jywarren added this to the Rich Wikis milestone Nov 18, 2016
@jywarren jywarren added the break-me-up break up for cleaner code separation, discrete tests, and, easier and iterative collaboration label Nov 18, 2016
@jywarren jywarren changed the title wiki page edit email notifications wiki page edit email notifications (max 1 per hour) Jan 5, 2017
@StlMaris123
Copy link
Collaborator

Hello @jywarren, could this issue be broken down a little bit. looks a little bulky to me.

@jywarren
Copy link
Member Author

jywarren commented May 11, 2017 via email

@StlMaris123
Copy link
Collaborator

StlMaris123 commented May 11, 2017 via email

@StlMaris123
Copy link
Collaborator

We could divide them into two tasks:

  1. No edits for over an hour
  • Acceptance tests
  • Send only one email if no edits have occurred within an hour.
  1. Several subsequent edits
  • Acceptance tests
  • Send only one email for all subsequent edits

However, I just thought we could have one email once a wiki page is created. We could have two links:

  • edit link
  • submit final

One can keep editing the wiki page until finally contented the click submit final. That is is when guys get notified about the wiki updates. That way we don't have to worry about the number of edits performed. What do you think?

@jywarren
Copy link
Member Author

Cool - i like the direction you're going.

Now that I think about it, the advantage to the number 1 is that we don't actually need ActionJob, because it'd be triggered by the edit itself.

I like the 2-stage edit sequence, but I think it'll be a bit more complex to implement, with an additional state needed for the post. Let's begin with your first task and think: where would this code go? The update action on wiki controller?

And could we break it up, like, could we have a node method like node.minutes_since_updated and see if it's larger than 60? Could we test that method?

Where would we put a test to ensure an email was sent upon the update method running?

Of course, I can help you find the answers to these, but this is the kind of "breaking it down into parts" i'd like to do. Can you try that in a bit more detail for the first item?

Thanks, Stella!

@ujithaperera
Copy link
Contributor

ujithaperera commented May 13, 2017

Hi @StlMaris123,

BTW I am Ujitha Perera. I also agree with the @jywarren . I feel that first we should make sure that active Job is up and running. Since this is a new module to the code base, have to create new active Jobs without affecting to the current functionalities.

And since we are using rails 3.2 active jobs don't support by default. hence we have to add active jobs as a gem to the codebase and then the queuing process. Since our DB size is not small, definitely we may have to go with parallel processing. Perhaps we may able to run email batches within the rails app. But it would be a huge load for the rails app and other functionalities might not work within that email processing time. Hope @jywarren will explain the actual requirement.

@StlMaris123 are you familiar with active jobs and background jobs ? if not, installing Redis and scheduling background jobs would be a great hands on experience for you to begin with.

@StlMaris123
Copy link
Collaborator

StlMaris123 commented May 14, 2017 via email

@StlMaris123
Copy link
Collaborator

@jywarren Please help me in breaking down the tasks into more distinct steps.

@jywarren
Copy link
Member Author

Hi, @StlMaris123 - i'll reply to this soon, sorry i've been tied up!

@jywarren
Copy link
Member Author

Hi, @StlMaris123 -- sorry for the delay but I've posted a proposed 2-phase plan to attempt the above as well as the next step. Check out #1421 and tell me what you think!

@SidharthBansal
Copy link
Member

If @jywarren you think this is a minor project OR can be broken into 2-3 minor projects then we can include this as hall of fame task in GCI

@stale stale bot added the stale label Oct 7, 2020
@publiclab publiclab deleted a comment from stale bot Oct 8, 2020
@stale stale bot removed the stale label Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
break-me-up break up for cleaner code separation, discrete tests, and, easier and iterative collaboration enhancement explains that the issue is to improve upon one of our existing features help wanted requires help by anyone willing to contribute
Projects
None yet
Development

No branches or pull requests

4 participants