mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-06 18:01:05 +00:00
Add Form::BaseBatch
class for "batch form update" objects (#35458)
This commit is contained in:
parent
62a23b1985
commit
70058ae49d
|
@ -1,13 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Form::AccountBatch
|
||||
include ActiveModel::Model
|
||||
include Authorization
|
||||
include AccountableConcern
|
||||
class Form::AccountBatch < Form::BaseBatch
|
||||
include Payloadable
|
||||
|
||||
attr_accessor :account_ids, :action, :current_account,
|
||||
:select_all_matching, :query
|
||||
attr_accessor :account_ids,
|
||||
:query,
|
||||
:select_all_matching
|
||||
|
||||
def save
|
||||
case action
|
||||
|
|
14
app/models/form/base_batch.rb
Normal file
14
app/models/form/base_batch.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Form::BaseBatch
|
||||
include ActiveModel::Model
|
||||
include Authorization
|
||||
include AccountableConcern
|
||||
|
||||
attr_accessor :action,
|
||||
:current_account
|
||||
|
||||
def save
|
||||
raise 'Override in subclass'
|
||||
end
|
||||
end
|
|
@ -1,12 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Form::CustomEmojiBatch
|
||||
include ActiveModel::Model
|
||||
include Authorization
|
||||
include AccountableConcern
|
||||
|
||||
attr_accessor :custom_emoji_ids, :action, :current_account,
|
||||
:category_id, :category_name, :visible_in_picker
|
||||
class Form::CustomEmojiBatch < Form::BaseBatch
|
||||
attr_accessor :category_id,
|
||||
:category_name,
|
||||
:visible_in_picker,
|
||||
:custom_emoji_ids
|
||||
|
||||
def save
|
||||
case action
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Form::DomainBlockBatch
|
||||
include ActiveModel::Model
|
||||
include Authorization
|
||||
include AccountableConcern
|
||||
|
||||
attr_accessor :domain_blocks_attributes, :action, :current_account
|
||||
class Form::DomainBlockBatch < Form::BaseBatch
|
||||
attr_accessor :domain_blocks_attributes
|
||||
|
||||
def save
|
||||
case action
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Form::EmailDomainBlockBatch
|
||||
include ActiveModel::Model
|
||||
include Authorization
|
||||
include AccountableConcern
|
||||
|
||||
attr_accessor :email_domain_block_ids, :action, :current_account
|
||||
class Form::EmailDomainBlockBatch < Form::BaseBatch
|
||||
attr_accessor :email_domain_block_ids
|
||||
|
||||
def save
|
||||
case action
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Form::IpBlockBatch
|
||||
include ActiveModel::Model
|
||||
include Authorization
|
||||
include AccountableConcern
|
||||
|
||||
attr_accessor :ip_block_ids, :action, :current_account
|
||||
class Form::IpBlockBatch < Form::BaseBatch
|
||||
attr_accessor :ip_block_ids
|
||||
|
||||
def save
|
||||
case action
|
||||
|
|
Loading…
Reference in New Issue
Block a user