mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-07 10:22:48 +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
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Form::AccountBatch
|
class Form::AccountBatch < Form::BaseBatch
|
||||||
include ActiveModel::Model
|
|
||||||
include Authorization
|
|
||||||
include AccountableConcern
|
|
||||||
include Payloadable
|
include Payloadable
|
||||||
|
|
||||||
attr_accessor :account_ids, :action, :current_account,
|
attr_accessor :account_ids,
|
||||||
:select_all_matching, :query
|
:query,
|
||||||
|
:select_all_matching
|
||||||
|
|
||||||
def save
|
def save
|
||||||
case action
|
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
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Form::CustomEmojiBatch
|
class Form::CustomEmojiBatch < Form::BaseBatch
|
||||||
include ActiveModel::Model
|
attr_accessor :category_id,
|
||||||
include Authorization
|
:category_name,
|
||||||
include AccountableConcern
|
:visible_in_picker,
|
||||||
|
:custom_emoji_ids
|
||||||
attr_accessor :custom_emoji_ids, :action, :current_account,
|
|
||||||
:category_id, :category_name, :visible_in_picker
|
|
||||||
|
|
||||||
def save
|
def save
|
||||||
case action
|
case action
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Form::DomainBlockBatch
|
class Form::DomainBlockBatch < Form::BaseBatch
|
||||||
include ActiveModel::Model
|
attr_accessor :domain_blocks_attributes
|
||||||
include Authorization
|
|
||||||
include AccountableConcern
|
|
||||||
|
|
||||||
attr_accessor :domain_blocks_attributes, :action, :current_account
|
|
||||||
|
|
||||||
def save
|
def save
|
||||||
case action
|
case action
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Form::EmailDomainBlockBatch
|
class Form::EmailDomainBlockBatch < Form::BaseBatch
|
||||||
include ActiveModel::Model
|
attr_accessor :email_domain_block_ids
|
||||||
include Authorization
|
|
||||||
include AccountableConcern
|
|
||||||
|
|
||||||
attr_accessor :email_domain_block_ids, :action, :current_account
|
|
||||||
|
|
||||||
def save
|
def save
|
||||||
case action
|
case action
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Form::IpBlockBatch
|
class Form::IpBlockBatch < Form::BaseBatch
|
||||||
include ActiveModel::Model
|
attr_accessor :ip_block_ids
|
||||||
include Authorization
|
|
||||||
include AccountableConcern
|
|
||||||
|
|
||||||
attr_accessor :ip_block_ids, :action, :current_account
|
|
||||||
|
|
||||||
def save
|
def save
|
||||||
case action
|
case action
|
||||||
|
|
Loading…
Reference in New Issue
Block a user