mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-02 13:03:05 -05:00
Introduce Glitch::Note (#193)
This is a model for attaching a single note to a single other entity. For #193, we'll use it for annotating blocks, mutes, and account-level domain blocks.
This commit is contained in:
parent
00ce2be148
commit
a37753179d
15
app/models/glitch/note.rb
Normal file
15
app/models/glitch/note.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: glitch_notes
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# target_id :integer not null
|
||||
# target_type :string not null
|
||||
# note :text not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
class Glitch::Note < ApplicationRecord
|
||||
belongs_to :target, polymorphic: true
|
||||
end
|
11
db/migrate/20180118192721_create_glitch_notes.rb
Normal file
11
db/migrate/20180118192721_create_glitch_notes.rb
Normal file
@ -0,0 +1,11 @@
|
||||
class CreateGlitchNotes < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :glitch_notes do |t|
|
||||
t.bigint :target_id, null: false
|
||||
t.string :target_type, null: false
|
||||
t.text :note, null: false
|
||||
t.index [:target_id, :target_type]
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
11
db/schema.rb
11
db/schema.rb
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20180106000232) do
|
||||
ActiveRecord::Schema.define(version: 20180118192721) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@ -182,6 +182,15 @@ ActiveRecord::Schema.define(version: 20180106000232) do
|
||||
t.index ["account_id"], name: "index_glitch_keyword_mutes_on_account_id"
|
||||
end
|
||||
|
||||
create_table "glitch_notes", force: :cascade do |t|
|
||||
t.bigint "target_id", null: false
|
||||
t.string "target_type", null: false
|
||||
t.text "note", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["target_id", "target_type"], name: "index_glitch_notes_on_target_id_and_target_type"
|
||||
end
|
||||
|
||||
create_table "imports", force: :cascade do |t|
|
||||
t.integer "type", null: false
|
||||
t.boolean "approved", default: false, null: false
|
||||
|
2
spec/fabricators/glitch_note_fabricator.rb
Normal file
2
spec/fabricators/glitch_note_fabricator.rb
Normal file
@ -0,0 +1,2 @@
|
||||
Fabricator('Glitch::Note') do
|
||||
end
|
5
spec/models/glitch/note_spec.rb
Normal file
5
spec/models/glitch/note_spec.rb
Normal file
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Glitch::Note, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user