Follow Plugin 👨

Hey, for some reason, the follow button isn’t working:


Thanks for the report. This is now fixed:


Hi, we happen to have the same issue reported by other users when removing the plugin.
Tried these rails commands but it seems to take ages (we have 6 million posts and more than 5000 users), is there a quicker way to get rid of these notifications?

1 Like

you could try destroy_all instead as in:

Notification.where(notification_type: [800,801,802]).destroy_all

However, that’s not a straight delete and will probably do a very similar thing, if lighter on transaction overhead. It will however still fire any required callbacks on each record. I would not advise just deleting records as it may mess up the integrity of your platform. One downside is that if that fails it will likely rollback the whole lot. The existing looping script will allow you to continue where you left off.

I’ve not tested that so do so at your own risk, preferably in a staging environment.

If you do use it, please let us know how it goes.

The other advantage with the original looped solution is you could add some puts (print statements) to reveal how far it has got through and how many there were in the first place - thereby showing progress and managing your expectations in one go - go to town and do share your final script!

1 Like

Well, so far it seems to get stuck directly on the first command:
myFollowNotifications = Notification.where(notification_type: [800,801,802])

After listing a lot of entries for a while it says “waiting for data… interrupt to abort” and nothing else seems to happen after that.

1 Like

You can also split things up into batches: ActiveRecord::Batches which will probably solve your issue (but will take no less time, just run more reliably).

1 Like

Ok, could you please give me an example? (my level of expertise with Rails is below average)

I don’t mind it takes the same time as long it doesn’t hang up.

1 Like

I don’t have any more time to spend on this atm. If you need a freelancer to provide dedicated support and have budget, please post in #marketplace for one. Our support period is the 1st 5 days of the month. If you can wait I may be able to help you out more then. In the meantime consider committing your own time to learn what you need to.

1 Like

No problem, understood.

I think however this issue should be considered as a major bug. When a plugin doesn’t uninstall cleanly and the data left behind causes major issues to the whole forum, then it should be considered as an error and be fixed.


So please share your solution with the community.

It’s not a bug per se. It’s merely that apparently the currently available migration script to remove the notifications is not optimised enough for your forum.

As this is open source I welcome your contribution to the solution to your own issue.


Ok, apparently solved, in the end I used this one with a limit thing that someone had provided in another topic:

Your code @merefield plus the .limit(10000).
Just ran it a few times, it cleared everything e many of our users got their notifications back.


Huzzah, well done! :tada:


I further agree this should be noted at least in the original post. This messed up my forum and wasted alot of time trying to figure out the cause before coming here and seeing comments in thread. I never would install this if noted the uninstall issues.


Please respect these things take 100’s of hours of volunteer work to build and then maintain. Software is never perfect and refined over its lifespan.

I’ve added it to the OP and once I get the thing working in batches and in one run will also add to the Readme. Longer term we might also add a button to the UI somewhere to permit the admin to run it.

PR always welcome btw!


OK, here are two possible variants that you will only need to run once. If someone gets chance to test them on a large forum in the rails sandbox (rails c --sandbox) and confirm they work I’d appreciate it (I’ve only tested on a small dataset). If you do this in the sandbox, no records will actually be deleted from your instance. Experience of using the script in the live environment when uninstalling the plugin will also be useful.

 Notification.where(notification_type: [800,801,802]).find_in_batches(batch_size: 1000) do |follow_notifications|
   follow_notifications.each { |follow_notification| follow_notification.destroy}

or perhaps more succinctly:

 Notification.where(notification_type: [800,801,802]).find_each do |follow_notification|

Both of these do things in batches, the latter implicitly.

I’ll be curious to know if there is a performance difference.

[1] pry(main)> Notification.where(notification_type: [800,801,802]).count
=> 8
[2] pry(main)> Notification.where(notification_type: [800,801,802]).find_in_batches(batch_size: 1000) do |follow_notifications|
[2] pry(main)*   follow_notifications.each { |follow_notification| follow_notification.destroy}
[2] pry(main)* end
=> nil
[3] pry(main)> Notification.where(notification_type: [800,801,802]).count
=> 0

Anyone know of a way to done down, customize or even get rid entirely of the notifications about followed users’ posts?


Currently the only settings are related to the act of initially following, but that leaves several:





This has been discussed before.

The feature request has been raised here:

But needs a lot more detail to implement and potentially a PR or a budget to push it through …

Please reply to that topic with suggestions on how to implement. Eg. do you do it per user, globally?

1 Like

OK, I’ve gone ahead and built the required logic to give users more discretion on what notifications they receive.

Also, the global setting now switches all follow notifications on or off for all users.

(default: ON)

If this is switched ON, user gets discretion:

(all default: ON).

It’s currently a PR to myself:

I’m currently testing it on one of my sites.

You can test it if you are brave :sweat_smile: :

- git clone -b add_granular_notifcation_settings

This should result in a lot less notification spam for people (so long as you tell them they can switch it off).

@buildthomas with these new additions I’ve switched things around a little so settings are ‘positive’ rather than ‘negative’ (aka enable versus disable). The global setting in admin now impacts all follow notifications. Once this is merged, be sure to let your users know to update their settings as I don’t intend to provide a migration.


FYI This was merged recently after I had some Production time with it. Let me know if you have any issues however.


@merefield idk if you’ve encountered this, but after installing the version with the optional notifications, my forum’s users started having problems with old notifications repeating. They do register that you’ve clicked them at first, but then after a while, those same notifications come back and this cycle then repeats endlessly. I’ve uninstalled and reinstalled a few times now using both the traditional method and using the ProCourse plugin installer, and it only occurs when this plugin is installed.