Adding a block model and filter mentions from blocked users (fix #60)
parent
a488b05726
commit
9d59d7b463
@ -0,0 +1,7 @@
|
||||
class Block < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :target_account, class_name: 'Account'
|
||||
|
||||
validates :account, :target_account, presence: true
|
||||
validates :account_id, uniqueness: { scope: :target_account_id }
|
||||
end
|
@ -0,0 +1,12 @@
|
||||
class CreateBlocks < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :blocks do |t|
|
||||
t.integer :account_id, null: false
|
||||
t.integer :target_account_id, null: false
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :blocks, [:account_id, :target_account_id], unique: true
|
||||
end
|
||||
end
|
@ -0,0 +1,3 @@
|
||||
Fabricator(:block) do
|
||||
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Block, type: :model do
|
||||
|
||||
end
|
Loading…
Reference in new issue