Skip to content

Commit

Permalink
actor and object are allowed to be nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Nov 27, 2024
1 parent 98df134 commit 2f2be1c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/models/federails/moderation/report.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Federails::Moderation::Report < ApplicationRecord
belongs_to :federails_actor, class_name: "Federails::Actor"
belongs_to :object, polymorphic: true
belongs_to :federails_actor, class_name: "Federails::Actor", optional: true
belongs_to :object, polymorphic: true, optional: true

def resolve!
update!(resolved_at: DateTime.now, resolution: "resolved")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ class CreateFederailsModerationReports < ActiveRecord::Migration[8.0]
def change
create_table :federails_moderation_reports do |t|
t.string :federated_url
t.references :federails_actor, null: false, foreign_key: true
t.references :federails_actor, foreign_key: true
t.string :content
t.references :object, polymorphic: true, null: false
t.references :object, polymorphic: true
t.datetime :resolved_at
t.string :resolution
t.timestamps
Expand Down
6 changes: 3 additions & 3 deletions spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@

create_table "federails_moderation_reports", force: :cascade do |t|
t.string "federated_url"
t.integer "federails_actor_id", null: false
t.integer "federails_actor_id"
t.string "content"
t.string "object_type", null: false
t.integer "object_id", null: false
t.string "object_type"
t.integer "object_id"
t.datetime "resolved_at"
t.string "resolution"
t.datetime "created_at", null: false
Expand Down

0 comments on commit 2f2be1c

Please sign in to comment.