Drop dmail filters.

Few people used dmail filters (~900 users in 5 years) and even fewer
used them correctly. Most people used them to try to block dmail spam,
but usually they either blocked too much (by adding common words that
are present in nearly all dmails, causing all mails to them to be
filtered) or too little (blocking specific email addresses or urls,
which usually are never seen again after the spammer is banned).
Nowadays the spam detection system does a better job of filtering spam.
This commit is contained in:
evazion
2020-01-19 12:55:58 -06:00
parent c2688e3aff
commit cae9a5d7e3
15 changed files with 11 additions and 317 deletions

View File

@@ -14,7 +14,6 @@ class Dmail < ApplicationRecord
belongs_to :from, :class_name => "User"
after_initialize :initialize_attributes, if: :new_record?
before_create :auto_read_if_filtered
after_create :update_recipient
after_commit :send_email, on: :create
@@ -185,16 +184,6 @@ class Dmail < ApplicationRecord
owner == to
end
def filtered?
CurrentUser.dmail_filter.try(:filtered?, self)
end
def auto_read_if_filtered
if is_recipient? && to.dmail_filter.try(:filtered?, self)
self.is_read = true
end
end
def update_recipient
if is_recipient? && !is_deleted? && !is_read?
to.update(has_mail: true, unread_dmail_count: to.dmails.unread.count)