* Fix weird breakpoint top-nav issue * Fix error handling when submitting blank note * Change status closed to invalid * Add ability to sort between status * WIP * Add working views for new report page * Add mailer WIP * Add MVP of new reports system * Move collapse to the right & add show page link * Fix buttons for index page * Change collapse to collapse/expand * Remove email functionality from new report * Update copy of report abuse responses * WIP of showing emails in reports * Fix notes for user_role_service.rb * Remove unused scripts from internal.html.erb * Update tests for reports dashboard * Add missing migration file * Add finishing touches to reports dashboard * Remove deprecated methods * Update view with better timestamps * Update and write new tests * Add .codeclimate.yml * Remove commented out editor thing * Undo commented out code for recaptcha method * Undo comment out code for development * Use new comment path instead of old comment path
30 lines
1 KiB
Ruby
30 lines
1 KiB
Ruby
class FeedbackMessage < ApplicationRecord
|
|
belongs_to :offender, foreign_key: "offender_id", class_name: "User", optional: true
|
|
belongs_to :reviewer, foreign_key: "reviewer_id", class_name: "User", optional: true
|
|
belongs_to :reporter, foreign_key: "reporter_id", class_name: "User", optional: true
|
|
belongs_to :victim, foreign_key: "victim_id", class_name: "User", optional: true
|
|
has_many :notes, as: :noteable, dependent: :destroy
|
|
|
|
validates_presence_of :feedback_type, :message
|
|
validates_presence_of :reported_url, :category, if: :abuse_report?
|
|
validates :category,
|
|
inclusion: {
|
|
in: ["spam", "other", "rude or vulgar", "harassment", "bug"],
|
|
}
|
|
validates :status,
|
|
inclusion: {
|
|
in: ["Open", "Invalid", "Resolved"],
|
|
}
|
|
|
|
def abuse_report?
|
|
feedback_type == "abuse-reports"
|
|
end
|
|
|
|
def capitalize_status
|
|
self.status = status.capitalize unless status.blank?
|
|
end
|
|
|
|
def email_messages
|
|
EmailMessage.where(feedback_message_id: id)
|
|
end
|
|
end
|