Drop forum subscriptions.

Few people used forum subscriptions (only around 100), and even fewer
people were subscribed to active threads. Most subscriptions were for
old threads that will never be bumped again. The implementation also had
a few problems:

* Unsubscribe links in emails didn't work (they unset the user's
  receive_email_notifications flag, but forum subscriptions didn't
  respect this flag).
* Some users had invalid email addresses, which caused notifications to
  bounce. There was no mechanism for preventing bounces.
* The implementation wasn't scalable. It involved a daily linear scan
  over _all_ forum subscriptions looking for any topics that had been updated.
This commit is contained in:
evazion
2020-01-19 13:44:09 -06:00
parent cae9a5d7e3
commit 13528ac2d3
12 changed files with 11 additions and 149 deletions

View File

@@ -4,8 +4,8 @@ class ForumTopicsController < ApplicationController
before_action :member_only, :except => [:index, :show]
before_action :moderator_only, :only => [:new_merge, :create_merge]
before_action :normalize_search, :only => :index
before_action :load_topic, :only => [:edit, :show, :update, :destroy, :undelete, :new_merge, :create_merge, :subscribe, :unsubscribe]
before_action :check_min_level, :only => [:show, :edit, :update, :new_merge, :create_merge, :destroy, :undelete, :subscribe, :unsubscribe]
before_action :load_topic, :only => [:edit, :show, :update, :destroy, :undelete, :new_merge, :create_merge]
before_action :check_min_level, :only => [:show, :edit, :update, :new_merge, :create_merge, :destroy, :undelete]
skip_before_action :api_check
def new
@@ -88,20 +88,6 @@ class ForumTopicsController < ApplicationController
redirect_to forum_topic_path(@merged_topic)
end
def subscribe
subscription = ForumSubscription.where(:forum_topic_id => @forum_topic.id, :user_id => CurrentUser.user.id).first
unless subscription
ForumSubscription.create(:forum_topic_id => @forum_topic.id, :user_id => CurrentUser.user.id, :last_read_at => @forum_topic.updated_at)
end
respond_with(@forum_topic)
end
def unsubscribe
subscription = ForumSubscription.where(:forum_topic_id => @forum_topic.id, :user_id => CurrentUser.user.id).first
subscription&.destroy
respond_with(@forum_topic)
end
private
def normalize_search