diff --git a/app/controllers/dmails_controller.rb b/app/controllers/dmails_controller.rb index ca4455a8a..c1e8814a8 100644 --- a/app/controllers/dmails_controller.rb +++ b/app/controllers/dmails_controller.rb @@ -61,7 +61,7 @@ class DmailsController < ApplicationController def dmail_params(context) permitted_params = %i[title body to_name to_id] if context == :create - permitted_params = %i[is_spam is_read is_deleted] if context == :update + permitted_params = %i[is_read is_deleted] if context == :update params.fetch(:dmail, {}).permit(permitted_params) end diff --git a/app/models/dmail.rb b/app/models/dmail.rb index eb9c81ab8..da2944f30 100644 --- a/app/models/dmail.rb +++ b/app/models/dmail.rb @@ -23,7 +23,6 @@ class Dmail < ApplicationRecord scope :deleted, -> { where(is_deleted: true) } scope :read, -> { where(is_read: true) } scope :unread, -> { where(is_read: false) } - scope :spam, -> { where(is_spam: true) } scope :visible, -> { where(owner: CurrentUser.user) } scope :sent, -> { where("dmails.owner_id = dmails.from_id") } scope :received, -> { where("dmails.owner_id = dmails.to_id") } @@ -126,8 +125,6 @@ class Dmail < ApplicationRecord active.received.unread when "sent" active.sent - when "spam" - active.spam when "deleted" deleted else @@ -138,7 +135,7 @@ class Dmail < ApplicationRecord def search(params) q = super - q = q.search_attributes(params, :to, :from, :is_spam, :is_read, :is_deleted, :title, :body) + q = q.search_attributes(params, :to, :from, :is_read, :is_deleted, :title, :body) q = q.text_attribute_matches(:title, params[:title_matches]) q = q.text_attribute_matches(:body, params[:message_matches], index_column: :message_index) @@ -186,7 +183,7 @@ class Dmail < ApplicationRecord end def send_email - if is_recipient? && !is_spam? && to.receive_email_notifications? && to.email =~ /@/ + if is_recipient? && !is_deleted? && to.receive_email_notifications? && to.email =~ /@/ UserMailer.dmail_notice(self).deliver_now end end diff --git a/app/views/dmails/_secondary_links.html.erb b/app/views/dmails/_secondary_links.html.erb index 0ccd16b88..abe96bc74 100644 --- a/app/views/dmails/_secondary_links.html.erb +++ b/app/views/dmails/_secondary_links.html.erb @@ -4,7 +4,6 @@ <%= subnav_link_to "Received", dmails_path(search: { folder: "received" }) %> <%= subnav_link_to "Unread", dmails_path(search: { folder: "unread" }) %> <%= subnav_link_to "Sent", dmails_path(search: { folder: "sent" }) %> - <%= subnav_link_to "Spam", dmails_path(search: { folder: "spam" }) %> <%= subnav_link_to "Deleted", dmails_path(search: { folder: "deleted" }) %>
  • |
  • <%= subnav_link_to "New", new_dmail_path %> diff --git a/app/views/dmails/show.html.erb b/app/views/dmails/show.html.erb index 6741660d1..90562b32a 100644 --- a/app/views/dmails/show.html.erb +++ b/app/views/dmails/show.html.erb @@ -28,11 +28,6 @@ <%= link_to "Respond", new_dmail_path(:respond_to_id => @dmail) %> | <%= link_to "Forward", new_dmail_path(:respond_to_id => @dmail, :forward => true) %> | <%= link_to "Share", dmail_path(@dmail, key: @dmail.key), title: "Anyone with this link will be able to view this dmail." %> - <% if @dmail.is_spam? %> - | <%= link_to "Not spam", dmail_path(@dmail, format: :js), remote: :true, method: :put, "data-params": "dmail[is_spam]=false" %> - <% else %> - | <%= link_to "Spam", dmail_path(@dmail, format: :js), remote: :true, method: :put, "data-params": "dmail[is_spam]=true" %> - <% end %> <% if @dmail.reportable_by?(CurrentUser.user) %> | <%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Dmail", model_id: @dmail.id }), remote: true, title: "Report this dmail to the moderators" %> <% end %>